Application propre sans erreurs. Bonne base sur laquelle repartir de zero en cas de soucis majeurs.
This commit is contained in:
16
README.md
16
README.md
@@ -1,16 +1,4 @@
|
||||
# afterwork
|
||||
# AfterWork Project
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
This project is structured according to best practices in Flutter development.
|
||||
|
||||
0
config/router.dart
Normal file
0
config/router.dart
Normal file
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
22
lib/config/injection/injection.dart
Normal file
22
lib/config/injection/injection.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../data/datasources/user_remote_data_source.dart';
|
||||
import '../../data/datasources/user_repository_impl.dart';
|
||||
import '../../domain/usecases/get_user.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
void init() {
|
||||
// Register Http Client
|
||||
sl.registerLazySingleton(() => http.Client());
|
||||
|
||||
// Register Data Sources
|
||||
sl.registerLazySingleton(() => UserRemoteDataSource(sl()));
|
||||
|
||||
// Register Repositories
|
||||
sl.registerLazySingleton(() => UserRepositoryImpl(remoteDataSource: sl()));
|
||||
|
||||
// Register Use Cases
|
||||
sl.registerLazySingleton(() => GetUser(sl()));
|
||||
}
|
||||
18
lib/config/router.dart
Normal file
18
lib/config/router.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:afterwork/presentation/screens/home/home_screen.dart';
|
||||
|
||||
class AppRouter {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
switch (settings.name) {
|
||||
case '/':
|
||||
return MaterialPageRoute(builder: (_) => const HomeScreen());
|
||||
// Ajoute d'autres routes ici
|
||||
default:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const Scaffold(
|
||||
body: Center(child: Text('Page not found')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
lib/core/constants/urls.dart
Normal file
6
lib/core/constants/urls.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
class Urls {
|
||||
static const String baseUrl = 'http://localhost:8085';
|
||||
// static const String login = baseUrl + 'auth/login';
|
||||
// static const String events = baseUrl + 'events';
|
||||
// Ajoute d'autres URLs ici
|
||||
}
|
||||
3
lib/core/errors/exceptions.dart
Normal file
3
lib/core/errors/exceptions.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
class ServerException implements Exception {}
|
||||
|
||||
class CacheException implements Exception {}
|
||||
9
lib/core/errors/failures.dart
Normal file
9
lib/core/errors/failures.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class Failure extends Equatable {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class ServerFailure extends Failure {}
|
||||
class CacheFailure extends Failure {}
|
||||
20
lib/core/theme/app_theme.dart
Normal file
20
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTheme {
|
||||
static final ThemeData lightTheme = ThemeData(
|
||||
primaryColor: Colors.blue,
|
||||
colorScheme: const ColorScheme.light(
|
||||
secondary: Colors.orange,
|
||||
),
|
||||
brightness: Brightness.light,
|
||||
buttonTheme: const ButtonThemeData(buttonColor: Colors.blue),
|
||||
);
|
||||
|
||||
static final ThemeData darkTheme = ThemeData(
|
||||
primaryColor: Colors.black,
|
||||
colorScheme: const ColorScheme.dark(
|
||||
secondary: Colors.red,
|
||||
),
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
}
|
||||
16
lib/core/utils/input_converter.dart
Normal file
16
lib/core/utils/input_converter.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:afterwork/core/errors/failures.dart';
|
||||
|
||||
class InputConverter {
|
||||
Either<Failure, int> stringToUnsignedInteger(String str) {
|
||||
try {
|
||||
final integer = int.parse(str);
|
||||
if (integer < 0) throw const FormatException();
|
||||
return Right(integer);
|
||||
} catch (e) {
|
||||
return Left(InvalidInputFailure());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidInputFailure extends Failure {}
|
||||
22
lib/data/datasources/user_remote_data_source.dart
Normal file
22
lib/data/datasources/user_remote_data_source.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'dart:convert';
|
||||
import 'package:afterwork/data/models/user_model.dart';
|
||||
import 'package:afterwork/core/constants/urls.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../core/errors/exceptions.dart';
|
||||
|
||||
class UserRemoteDataSource {
|
||||
final http.Client client;
|
||||
|
||||
UserRemoteDataSource(this.client);
|
||||
|
||||
Future<UserModel> getUser(String id) async {
|
||||
final response = await client.get(Uri.parse('${Urls.baseUrl}/user/$id'));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return UserModel.fromJson(json.decode(response.body));
|
||||
} else {
|
||||
throw ServerException();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
lib/data/datasources/user_repository_impl.dart
Normal file
14
lib/data/datasources/user_repository_impl.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:afterwork/domain/entities/user.dart';
|
||||
import 'package:afterwork/domain/repositories/user_repository.dart';
|
||||
import 'package:afterwork/data/datasources/user_remote_data_source.dart';
|
||||
|
||||
class UserRepositoryImpl implements UserRepository {
|
||||
final UserRemoteDataSource remoteDataSource;
|
||||
|
||||
UserRepositoryImpl({required this.remoteDataSource});
|
||||
|
||||
@override
|
||||
Future<User> getUser(String id) async {
|
||||
return await remoteDataSource.getUser(id);
|
||||
}
|
||||
}
|
||||
26
lib/data/models/user_model.dart
Normal file
26
lib/data/models/user_model.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
import '../../domain/entities/user.dart';
|
||||
|
||||
class UserModel extends User {
|
||||
const UserModel({
|
||||
required super.id,
|
||||
required super.name,
|
||||
required super.email,
|
||||
});
|
||||
|
||||
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||||
return UserModel(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'email': email,
|
||||
};
|
||||
}
|
||||
}
|
||||
12
lib/domain/entities/user.dart
Normal file
12
lib/domain/entities/user.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class User extends Equatable {
|
||||
final String id;
|
||||
final String name;
|
||||
final String email;
|
||||
|
||||
const User({required this.id, required this.name, required this.email});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name, email];
|
||||
}
|
||||
5
lib/domain/repositories/user_repository.dart
Normal file
5
lib/domain/repositories/user_repository.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'package:afterwork/domain/entities/user.dart';
|
||||
|
||||
abstract class UserRepository {
|
||||
Future<User> getUser(String id);
|
||||
}
|
||||
19
lib/domain/usecases/get_user.dart
Normal file
19
lib/domain/usecases/get_user.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:afterwork/domain/entities/user.dart';
|
||||
import 'package:afterwork/domain/repositories/user_repository.dart';
|
||||
import 'package:afterwork/core/errors/failures.dart';
|
||||
|
||||
class GetUser {
|
||||
final UserRepository repository;
|
||||
|
||||
GetUser(this.repository);
|
||||
|
||||
Future<Either<Failure, User>> call(String id) async {
|
||||
try {
|
||||
final user = await repository.getUser(id);
|
||||
return Right(user);
|
||||
} catch (e) {
|
||||
return Left(ServerFailure());
|
||||
}
|
||||
}
|
||||
}
|
||||
122
lib/main.dart
122
lib/main.dart
@@ -1,125 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'config/router.dart';
|
||||
import 'core/theme/app_theme.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
runApp(const AfterWorkApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
class AfterWorkApp extends StatelessWidget {
|
||||
const AfterWorkApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
||||
// the application has a purple toolbar. Then, without quitting the app,
|
||||
// try changing the seedColor in the colorScheme below to Colors.green
|
||||
// and then invoke "hot reload" (save your changes or press the "hot
|
||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
||||
// the command line to start the app).
|
||||
//
|
||||
// Notice that the counter didn't reset back to zero; the application
|
||||
// state is not lost during the reload. To reset the state, use hot
|
||||
// restart instead.
|
||||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
|
||||
// This widget is the home page of your application. It is stateful, meaning
|
||||
// that it has a State object (defined below) that contains fields that affect
|
||||
// how it looks.
|
||||
|
||||
// This class is the configuration for the state. It holds the values (in this
|
||||
// case the title) provided by the parent (in this case the App widget) and
|
||||
// used by the build method of the State. Fields in a Widget subclass are
|
||||
// always marked "final".
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
// This call to setState tells the Flutter framework that something has
|
||||
// changed in this State, which causes it to rerun the build method below
|
||||
// so that the display can reflect the updated values. If we changed
|
||||
// _counter without calling setState(), then the build method would not be
|
||||
// called again, and so nothing would appear to happen.
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
// The Flutter framework has been optimized to make rerunning build methods
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
// TRY THIS: Try changing the color here to a specific color (to
|
||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
||||
// change color while the other colors stay the same.
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
child: Column(
|
||||
// Column is also a layout widget. It takes a list of children and
|
||||
// arranges them vertically. By default, it sizes itself to fit its
|
||||
// children horizontally, and tries to be as tall as its parent.
|
||||
//
|
||||
// Column has various properties to control how it sizes itself and
|
||||
// how it positions its children. Here we use mainAxisAlignment to
|
||||
// center the children vertically; the main axis here is the vertical
|
||||
// axis because Columns are vertical (the cross axis would be
|
||||
// horizontal).
|
||||
//
|
||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
||||
// action in the IDE, or press "p" in the console), to see the
|
||||
// wireframe for each widget.
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text(
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
title: 'AfterWork',
|
||||
theme: AppTheme.lightTheme,
|
||||
onGenerateRoute: AppRouter.generateRoute,
|
||||
initialRoute: '/',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
18
lib/presentation/screens/event/event_screen.dart
Normal file
18
lib/presentation/screens/event/event_screen.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EventScreen extends StatelessWidget {
|
||||
const EventScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Événements'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('Liste des événements'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
17
lib/presentation/screens/home/home_screen.dart
Normal file
17
lib/presentation/screens/home/home_screen.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('AfterWork'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('Bienvenue sur AfterWork!'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/presentation/state_management/user_bloc.dart
Normal file
43
lib/presentation/state_management/user_bloc.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:afterwork/domain/entities/user.dart';
|
||||
import 'package:afterwork/domain/usecases/get_user.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class UserBloc extends Bloc<UserEvent, UserState> {
|
||||
final GetUser getUser;
|
||||
|
||||
UserBloc({required this.getUser}) : super(UserInitial());
|
||||
|
||||
Stream<UserState> mapEventToState(UserEvent event) async* {
|
||||
if (event is GetUserById) {
|
||||
yield UserLoading();
|
||||
final either = await getUser(event.id);
|
||||
|
||||
yield either.fold(
|
||||
(failure) => UserError(),
|
||||
(user) => UserLoaded(user: user),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class UserEvent {}
|
||||
|
||||
class GetUserById extends UserEvent {
|
||||
final String id;
|
||||
|
||||
GetUserById(this.id);
|
||||
}
|
||||
|
||||
abstract class UserState {}
|
||||
|
||||
class UserInitial extends UserState {}
|
||||
|
||||
class UserLoading extends UserState {}
|
||||
|
||||
class UserLoaded extends UserState {
|
||||
final User user;
|
||||
|
||||
UserLoaded({required this.user});
|
||||
}
|
||||
|
||||
class UserError extends UserState {}
|
||||
17
lib/presentation/widgets/custom_button.dart
Normal file
17
lib/presentation/widgets/custom_button.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomButton extends StatelessWidget {
|
||||
final String text;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const CustomButton({super.key, required this.text, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
child: Text(text),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
80
pubspec.lock
80
pubspec.lock
@@ -9,6 +9,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.11.0"
|
||||
bloc:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bloc
|
||||
sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.4"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -49,6 +57,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
dartz:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dartz
|
||||
sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.1"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: equatable
|
||||
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -62,6 +86,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_bloc:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_bloc
|
||||
sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.6"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -75,6 +107,30 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
get_it:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: get_it
|
||||
sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.7.0"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.6"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -131,6 +187,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -139,6 +203,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: provider
|
||||
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -192,6 +264,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
60
pubspec.yaml
60
pubspec.yaml
@@ -1,61 +1,40 @@
|
||||
name: afterwork
|
||||
description: "A new Flutter project."
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.1
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
|
||||
# State management with flutter_bloc
|
||||
flutter_bloc: ^8.0.1
|
||||
|
||||
# HTTP client for API requests
|
||||
http: ^0.13.3
|
||||
|
||||
# Dependency injection with get_it
|
||||
get_it: ^7.2.0
|
||||
|
||||
# Equatable for easier comparison of objects
|
||||
equatable: ^2.0.3
|
||||
|
||||
# Functional programming utilities
|
||||
dartz: ^0.10.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^4.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
@@ -63,17 +42,10 @@ flutter:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/to/resolution-aware-images
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/to/asset-from-package
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# list giving the asset and other descriptors for the font. For example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:afterwork/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user