diff --git a/android/build.gradle b/android/build.gradle index 83ae220..3cdaac9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/layout/home_layout.dart b/lib/layout/home_layout.dart index 789c419..9ae3f99 100644 --- a/lib/layout/home_layout.dart +++ b/lib/layout/home_layout.dart @@ -8,45 +8,52 @@ import '../shared/components/components.dart'; import '../shared/cubits/home_cubit/home_cubit.dart'; class HomeLayout extends StatelessWidget { + const HomeLayout({super.key}); @override Widget build(BuildContext context) { return BlocConsumer( - listener: (context, state) {}, - builder: (context, state) { - var cubit = HomeCubit.get(context); + listener: (context, state) {}, + builder: (context, state) { + var cubit = HomeCubit.get(context); - return Scaffold( - appBar: AppBar( - title: logo, - actions: [ - IconButton( - onPressed: (){ - navigateTo(context, SearchScreen()); - }, - icon: Icon(CupertinoIcons.search, size: 24.0.sp,), + return Scaffold( + appBar: AppBar( + title: logo, + actions: [ + IconButton( + onPressed: () { + navigateTo(context, const SearchScreen()); + }, + icon: Icon( + CupertinoIcons.search, + size: 24.0.sp, ), - ], ), - body: cubit.screens[cubit.currentIndex], - bottomNavigationBar: ClipRRect( - borderRadius: BorderRadius.only(topRight: Radius.circular(10.0), topLeft: Radius.circular(10.0),), - child: SizedBox( - height: MediaQuery.of(context).size.height / 12.8, - child: BottomNavigationBar( - onTap: (index){ - cubit.changeNavIndex(index); - }, - unselectedFontSize: 11.0.sp, - selectedFontSize: 12.0.sp, - currentIndex: cubit.currentIndex, - items: cubit.navItems, - iconSize: MediaQuery.of(context).size.height / 30.0, - ), + ], + ), + body: cubit.screens[cubit.currentIndex], + bottomNavigationBar: ClipRRect( + borderRadius: const BorderRadius.only( + topRight: Radius.circular(10.0), + topLeft: Radius.circular(10.0), + ), + child: SizedBox( + height: MediaQuery.of(context).size.height / 12.8, + child: BottomNavigationBar( + onTap: (index) { + cubit.changeNavIndex(index); + }, + unselectedFontSize: 11.0.sp, + selectedFontSize: 12.0.sp, + currentIndex: cubit.currentIndex, + items: cubit.navItems, + iconSize: MediaQuery.of(context).size.height / 30.0, ), ), - ); - }, - ); + ), + ); + }, + ); } } diff --git a/lib/main.dart b/lib/main.dart index 2040c87..7738110 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -15,57 +14,55 @@ import 'package:shop_app/shared/network/local/cache_helper.dart'; import 'package:shop_app/shared/network/remote/dio.dart'; import 'package:shop_app/shared/network/styles/styles.dart'; -void main() async{ +void main() async { WidgetsFlutterBinding.ensureInitialized(); - ByteData data = await PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem'); - SecurityContext.defaultContext.setTrustedCertificatesBytes(data.buffer.asUint8List(),); + ByteData data = + await PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem'); + SecurityContext.defaultContext.setTrustedCertificatesBytes( + data.buffer.asUint8List(), + ); DioHelper.init(); await CacheHelper.init(); String token = CacheHelper.getData(key: 'token') ?? ''; bool onboardingIsSeen = CacheHelper.getData(key: 'onboardingIsSeen') ?? false; Widget startWidget = OnboardingScreen(); - if(onboardingIsSeen) - { - if(token != '') - { - startWidget = HomeLayout(); - } - else - { - startWidget = LoginScreen(); - } + if (onboardingIsSeen) { + if (token != '') { + startWidget = const HomeLayout(); + } else { + startWidget = const LoginScreen(); } + } - runApp(MyApp(startWidget)); + runApp(MyApp(startWidget: startWidget)); } + +// ignore: must_be_immutable class MyApp extends StatelessWidget { - Widget startWidget; + Widget? startWidget; - MyApp(this.startWidget); + MyApp({super.key, this.startWidget}); // This widget is the root of your application. @override Widget build(BuildContext context) { - SystemChrome.setPreferredOrientations( - [ - DeviceOrientation.portraitUp, - DeviceOrientation.portraitDown, - ] - ); - return MultiBlocProvider( + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); + return MultiBlocProvider( providers: [ - BlocProvider( - create: (context) => OnBoardingCubit() - ), + BlocProvider(create: (context) => OnBoardingCubit()), BlocProvider( create: (context) => LoginCubit(), ), BlocProvider( - create: (context) => HomeCubit()..getHomeData() - ..getCategoryData() - ..getFavorites() - ..getProfileData(), + create: (context) => HomeCubit() + ..getHomeData() + ..getCategoryData() + ..getFavorites() + ..getProfileData(), ) ], child: BlocConsumer( @@ -75,12 +72,13 @@ class MyApp extends StatelessWidget { designSize: const Size(360, 690), minTextAdapt: true, splitScreenMode: true, - builder: (context , child) - { + builder: (context, child) { return MaterialApp( debugShowCheckedModeBanner: false, theme: lightTheme, - themeMode: HomeCubit.get(context).isDark ? ThemeMode.dark : ThemeMode.light, + themeMode: HomeCubit.get(context).isDark + ? ThemeMode.dark + : ThemeMode.light, darkTheme: darkTheme, home: startWidget, ); diff --git a/lib/models/category_model.dart b/lib/models/category_model.dart index b361247..64a5929 100644 --- a/lib/models/category_model.dart +++ b/lib/models/category_model.dart @@ -1,39 +1,33 @@ -class CategoryModel -{ +class CategoryModel { late bool status; late CategoryDataModel data; - CategoryModel.fromJson(Map json) - { + CategoryModel.fromJson(Map json) { status = json['status']; data = CategoryDataModel.fromJson(json["data"]); } } -class CategoryDataModel -{ +class CategoryDataModel { late int currentPage; - List? data = []; + List? data = []; - CategoryDataModel.fromJson(Mapjson) - { + CategoryDataModel.fromJson(Map json) { currentPage = json['current_page']; - json['data'].forEach((element){ - data?.add(DataModel_C.fromJson(element)); + json['data'].forEach((element) { + data?.add(DataModelC.fromJson(element)); }); } } -class DataModel_C -{ +class DataModelC { late int id; late String name; late String image; - DataModel_C.fromJson(Mapjson) - { + DataModelC.fromJson(Map json) { id = json['id']; name = json['name']; image = json['image']; } -} \ No newline at end of file +} diff --git a/lib/models/favorite_model.dart b/lib/models/favorite_model.dart index 54e0c1e..b5889ff 100644 --- a/lib/models/favorite_model.dart +++ b/lib/models/favorite_model.dart @@ -1,13 +1,9 @@ -import 'package:shop_app/models/home_data_model.dart'; - -class FavoriteModel -{ +class FavoriteModel { late bool status; late String message; - FavoriteModel.fromJson(Map json) - { + FavoriteModel.fromJson(Map json) { status = json['status']; message = json['message']; } -} \ No newline at end of file +} diff --git a/lib/models/get_favorites_model.dart b/lib/models/get_favorites_model.dart index 938a444..8caa092 100644 --- a/lib/models/get_favorites_model.dart +++ b/lib/models/get_favorites_model.dart @@ -1,15 +1,16 @@ import 'package:shop_app/models/home_data_model.dart'; -class GetFavoriteModel -{ +class GetFavoriteModel { late bool status; - List products = []; + List? products; - GetFavoriteModel.fromJson(Map json) - { - status = json['status']; - json['data']['data'].forEach((product){ - products.add(Product.fromJsonFav(product['product'])); - }); + GetFavoriteModel.fromJson(Map json) { + try { + status = json['status']; + json['data']['data'].forEach((product) { + products?.add(Product.fromJsonFav(product['product'])); + }); + // ignore: empty_catches + } catch (e) {} } -} \ No newline at end of file +} diff --git a/lib/models/profile_model.dart b/lib/models/profile_model.dart index e72ceb6..b61b45b 100644 --- a/lib/models/profile_model.dart +++ b/lib/models/profile_model.dart @@ -1,13 +1,14 @@ import '../modules/login_model.dart'; -class ProfileModel -{ +class ProfileModel { late bool status; late UserData data; - ProfileModel.fromJson(Map json) - { + ProfileModel.fromJson(Map json) { status = json['status']; - data = UserData.fromJson(json['data']); + try { + data = UserData.fromJson(json['data']); + // ignore: empty_catches + } catch (e) {} } -} \ No newline at end of file +} diff --git a/lib/modules/category_screen.dart b/lib/modules/category_screen.dart index aaac51e..eb310ed 100644 --- a/lib/modules/category_screen.dart +++ b/lib/modules/category_screen.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unnecessary_null_comparison + import 'package:cached_network_image/cached_network_image.dart'; import 'package:conditional_builder_null_safety/conditional_builder_null_safety.dart'; import 'package:flutter/material.dart'; @@ -11,31 +13,37 @@ import 'package:shop_app/shared/network/styles/colors.dart'; import '../shared/components/components.dart'; class CategoryScreen extends StatelessWidget { + const CategoryScreen({super.key}); @override Widget build(BuildContext context) { return BlocConsumer( - listener: (context, state) {}, - builder: (context, state) { - return ConditionalBuilder( - condition: HomeCubit.get(context).categoryModel != null, - builder:(context) => Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0,), - child: ListView.separated( - physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => categoryBuilder(HomeCubit.get(context).categoryModel.data.data![index], context), - separatorBuilder: (context, index) => SizedBox(height: 20.0,), - itemCount: HomeCubit.get(context).categoryModel.data.data!.length, + listener: (context, state) {}, + builder: (context, state) { + return ConditionalBuilder( + condition: HomeCubit.get(context).categoryModel != null, + builder: (context) => Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, + ), + child: ListView.separated( + physics: const BouncingScrollPhysics(), + itemBuilder: (context, index) => categoryBuilder( + HomeCubit.get(context).categoryModel.data.data![index], + context), + separatorBuilder: (context, index) => const SizedBox( + height: 20.0, ), + itemCount: HomeCubit.get(context).categoryModel.data.data!.length, ), - fallback:(context) => Center(child: loading), - ); - }, + ), + fallback: (context) => Center(child: loading), + ); + }, ); } - Widget categoryBuilder(DataModel_C category, context) - { + Widget categoryBuilder(DataModelC category, context) { double screenHeight = MediaQuery.of(context).size.height; return Material( @@ -53,7 +61,9 @@ class CategoryScreen extends StatelessWidget { height: screenHeight / 4.5, width: screenHeight / 4.5, ), - SizedBox(width: 10.0.w,), + SizedBox( + width: 10.0.w, + ), Expanded( child: Padding( padding: EdgeInsets.only(top: 20.0.h), @@ -64,7 +74,9 @@ class CategoryScreen extends StatelessWidget { style: TextStyle( fontSize: 20.0.sp, fontWeight: FontWeight.w700, - color: HomeCubit.get(context).isDark ? Colors.white : Colors.black, + color: HomeCubit.get(context).isDark + ? Colors.white + : Colors.black, ), ), ), @@ -72,7 +84,11 @@ class CategoryScreen extends StatelessWidget { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.arrow_forward_rounded, size: 26.0.sp, color: skin,), + Icon( + Icons.arrow_forward_rounded, + size: 26.0.sp, + color: skin, + ), ], ), ], diff --git a/lib/modules/edit_profile_screen.dart b/lib/modules/edit_profile_screen.dart index 07d534e..d27c336 100644 --- a/lib/modules/edit_profile_screen.dart +++ b/lib/modules/edit_profile_screen.dart @@ -9,6 +9,7 @@ import 'package:shop_app/shared/cubits/home_cubit/home_cubit.dart'; import 'package:shop_app/shared/cubits/home_cubit/home_states.dart'; import '../shared/network/styles/colors.dart'; +// ignore: must_be_immutable class EditProfileScreen extends StatelessWidget { TextEditingController nameController = TextEditingController(); TextEditingController phoneController = TextEditingController(); @@ -16,31 +17,29 @@ class EditProfileScreen extends StatelessWidget { TextEditingController passwordController = TextEditingController(); var formKey = GlobalKey(); + EditProfileScreen({super.key}); + @override Widget build(BuildContext context) { - return BlocConsumer( + return BlocConsumer( listener: (context, state) { - if(state is UpdateProfileSuccessState) - { - if(state.model.status) - { - defaultToast( - context: context, - message: state.model.message, - iconColor: Colors.lightGreen, - icon: Icons.check_circle, - ); - } - else - { - defaultToast( - context: context, - message: state.model.message, - iconColor: Colors.red, - icon: Icons.error, - ); - } + if (state is UpdateProfileSuccessState) { + if (state.model.status) { + defaultToast( + context: context, + message: state.model.message, + iconColor: Colors.lightGreen, + icon: Icons.check_circle, + ); + } else { + defaultToast( + context: context, + message: state.model.message, + iconColor: Colors.red, + icon: Icons.error, + ); } + } }, builder: (context, state) { HomeCubit cubit = HomeCubit.get(context); @@ -52,13 +51,15 @@ class EditProfileScreen extends StatelessWidget { ), body: ConditionalBuilder( condition: cubit.profileModel != null, - builder: (context) => Container( + builder: (context) => SizedBox( width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - if(state is UpdateProfileLoadingState) - LinearProgressIndicator(color: blue, ), + if (state is UpdateProfileLoadingState) + LinearProgressIndicator( + color: blue, + ), //edit image Stack( alignment: Alignment.topRight, @@ -71,16 +72,20 @@ class EditProfileScreen extends StatelessWidget { child: ClipRRect( clipBehavior: Clip.hardEdge, borderRadius: BorderRadius.circular(50.0.sp), - child: cubit.editImage != '' ? - Image.file( - File(cubit.editImage,), - height: double.infinity, - width: double.infinity,) - : Image( - image: NetworkImage(cubit.profileModel!.data.image), - ), - ), + child: cubit.editImage != '' + ? Image.file( + File( + cubit.editImage, + ), + height: double.infinity, + width: double.infinity, + ) + : Image( + image: NetworkImage( + cubit.profileModel!.data.image), + ), ), + ), ), CircleAvatar( radius: 15.0.sp, @@ -92,25 +97,29 @@ class EditProfileScreen extends StatelessWidget { child: IconButton( onPressed: () async { final imagePicker = ImagePicker(); - final image = await imagePicker.pickImage(source: ImageSource.gallery); + final image = await imagePicker.pickImage( + source: ImageSource.gallery); cubit.changeImage(image!.path); }, - icon: Icon(Icons.edit_outlined, - color: cubit.isDark ? skin : Colors.black, + icon: Icon( + Icons.edit_outlined, + color: cubit.isDark ? skin : Colors.black, size: 24.0.sp, ), color: Colors.black, - padding: EdgeInsets.all(0.0), + padding: const EdgeInsets.all(0.0), ), ), ) ], ), - SizedBox(height: 20.0.h,), + SizedBox( + height: 20.0.h, + ), //name Expanded( child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), child: Form( key: formKey, child: Padding( @@ -118,63 +127,74 @@ class EditProfileScreen extends StatelessWidget { child: Column( children: [ defaultTFF( - text: 'Name', - prefixIcon: Icons.person, - controller: nameController, - onTap: () - { - nameController.text = cubit.profileModel!.data.name; - }, - validate: (value){ - if(value != null && value == '') - return 'Please, Enter Your Name'; - } + text: 'Name', + prefixIcon: Icons.person, + controller: nameController, + onTap: () { + nameController.text = + cubit.profileModel!.data.name; + }, + validate: (value) { + if (value != null && value == '') { + return 'Please, Enter Your Name'; + } + return null; + }), + SizedBox( + height: 15.0.h, ), - SizedBox(height: 15.0.h,), //email defaultTFF( - text: 'Email', - prefixIcon: Icons.alternate_email, - controller: emailController, - onTap: () - { - emailController.text = cubit.profileModel!.data.email; - }, - keyboardType: TextInputType.emailAddress, - validate: (value){ - if(value != null && value == '') - return 'Please, Enter Email Address'; - } - ), + text: 'Email', + prefixIcon: Icons.alternate_email, + controller: emailController, + onTap: () { + emailController.text = + cubit.profileModel!.data.email; + }, + keyboardType: TextInputType.emailAddress, + validate: (value) { + if (value != null && value == '') { + return 'Please, Enter Email Address'; + } + return null; + }), - SizedBox(height: 15.0.h,), + SizedBox( + height: 15.0.h, + ), //password defaultTFF( text: 'Password', prefixIcon: Icons.lock_outline_rounded, controller: passwordController, isObscure: true, - validate: (value){ - if(value != null && value == '') - return 'Please, Enter Password'; - }, + validate: (value) { + if (value != null && value == '') { + return 'Please, Enter Password'; + } + return null; + }, + ), + SizedBox( + height: 15.0.h, ), - SizedBox(height: 15.0.h,), //phone defaultTFF( - text: 'Phone', - prefixIcon: Icons.phone, - controller: phoneController, - keyboardType: TextInputType.phone, - onTap: () - { - phoneController.text = cubit.profileModel!.data.phone; - }, - validate: (value){ - if(value != null && value == '') - return 'Please, Enter Phone Number'; - } - ), + text: 'Phone', + prefixIcon: Icons.phone, + controller: phoneController, + keyboardType: TextInputType.phone, + onTap: () { + phoneController.text = + cubit.profileModel!.data.phone; + }, + validate: (value) { + if (value != null && value == '') { + return 'Please, Enter Phone Number'; + } + return null; + }), ], ), ), @@ -183,20 +203,21 @@ class EditProfileScreen extends StatelessWidget { ), //Update Button Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0,), - child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, + ), + child: SizedBox( width: double.infinity, child: defaultButton( - onPressed: (){ - if(formKey.currentState!.validate()) - { - cubit.updateProfile( - name: nameController.text, - phone: phoneController.text, - password: passwordController.text, - email: emailController.text, - ); - } + onPressed: () { + if (formKey.currentState!.validate()) { + cubit.updateProfile( + name: nameController.text, + phone: phoneController.text, + password: passwordController.text, + email: emailController.text, + ); + } }, child: Text( 'Update Changes', @@ -209,7 +230,9 @@ class EditProfileScreen extends StatelessWidget { ), ), ), - SizedBox(height: 5.0.h,), + SizedBox( + height: 5.0.h, + ), ], ), ), diff --git a/lib/modules/favorites_screen.dart b/lib/modules/favorites_screen.dart index 39fff74..757a49d 100644 --- a/lib/modules/favorites_screen.dart +++ b/lib/modules/favorites_screen.dart @@ -10,6 +10,8 @@ import '../shared/components/components.dart'; import '../shared/network/styles/colors.dart'; class FavoritesScreen extends StatelessWidget { + const FavoritesScreen({super.key}); + @override Widget build(BuildContext context) { return BlocConsumer( @@ -31,6 +33,7 @@ class FavoritesScreen extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric(horizontal: 20.0), child: ConditionalBuilder( + // ignore: unnecessary_null_comparison condition: cubit.getFavoriteModel != null, builder: (context) => Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -47,13 +50,13 @@ class FavoritesScreen extends StatelessWidget { ), Expanded( child: ListView.separated( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemBuilder: (context, index) => favoriteItemBuilder( - cubit.getFavoriteModel.products[index], context), + cubit.getFavoriteModel.products![index], context), separatorBuilder: (context, index) => SizedBox( height: 20.0.h, ), - itemCount: cubit.getFavoriteModel.products.length, + itemCount: cubit.getFavoriteModel.products!.length, ), ), ], @@ -122,23 +125,23 @@ class FavoritesScreen extends StatelessWidget { onTap: () { HomeCubit.get(context).changeFavorite(product.id); }, + highlightColor: HomeCubit.get(context).isDark + ? asmar + : Colors.white, child: Container( padding: EdgeInsets.all(7.0.w), child: Icon( Icons.heart_broken, color: metal, size: 25.0.w, - ), - ), - highlightColor: HomeCubit.get(context).isDark - ? asmar - : Colors.white, + ), ), ), ), + ), ], ), - Spacer(), + const Spacer(), Padding( padding: EdgeInsets.only( bottom: 10.0.h, @@ -146,7 +149,7 @@ class FavoritesScreen extends StatelessWidget { child: Row( children: [ Text( - product.price.toString() + ' EGP', + '${product.price} EGP', style: TextStyle( color: orange, fontSize: 18.0.sp, @@ -154,13 +157,13 @@ class FavoritesScreen extends StatelessWidget { maxLines: 1, overflow: TextOverflow.ellipsis, ), - SizedBox( + const SizedBox( width: 5.0, ), if (product.price != product.oldPrice) Expanded( child: Text( - product.oldPrice.toString() + ' EGP', + '${product.oldPrice} EGP', style: TextStyle( fontSize: 14.0.sp, color: skin, diff --git a/lib/modules/login_screen.dart b/lib/modules/login_screen.dart index 696d913..56d83fe 100644 --- a/lib/modules/login_screen.dart +++ b/lib/modules/login_screen.dart @@ -13,6 +13,8 @@ import 'package:shop_app/shared/network/local/cache_helper.dart'; import 'package:shop_app/shared/network/styles/colors.dart'; class LoginScreen extends StatelessWidget { + const LoginScreen({super.key}); + @override Widget build(BuildContext context) { TextEditingController emailController = TextEditingController(); @@ -33,7 +35,7 @@ class LoginScreen extends StatelessWidget { HomeCubit.get(context).getHomeData(); HomeCubit.get(context).getFavorites(); HomeCubit.get(context).getProfileData(); - navigateAndRemove(context, HomeLayout()); + navigateAndRemove(context, const HomeLayout()); } else { defaultToast( context: context, @@ -55,7 +57,7 @@ class LoginScreen extends StatelessWidget { children: [ Expanded( child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), child: Form( key: formKey, child: Column( @@ -82,8 +84,10 @@ class LoginScreen extends StatelessWidget { keyboardType: TextInputType.emailAddress, prefixIcon: Icons.alternate_email, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter an Email'; + } + return null; }), SizedBox( height: 20.0.h, @@ -100,8 +104,10 @@ class LoginScreen extends StatelessWidget { LoginCubit.get(context).changeVisibilityMode(); }, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter your password'; + } + return null; }), SizedBox( height: 40.0.h, @@ -112,10 +118,11 @@ class LoginScreen extends StatelessWidget { children: [ ConditionalBuilder( condition: state is! LoginLoadingState, + // ignore: non_constant_identifier_names builder: (Context) => defaultButton( onPressed: () { if (formKey.currentState!.validate()) { - LoginCubit.get(context).LogIn( + LoginCubit.get(context).logIn( email: emailController.text.toString(), password: passwordController.text.toString(), @@ -133,7 +140,7 @@ class LoginScreen extends StatelessWidget { fontSize: 14.0.sp, ), ), - SizedBox( + const SizedBox( width: 5.0, ), Icon( diff --git a/lib/modules/onboarding_screen.dart b/lib/modules/onboarding_screen.dart index 7ccf09e..f0e26f0 100644 --- a/lib/modules/onboarding_screen.dart +++ b/lib/modules/onboarding_screen.dart @@ -9,6 +9,7 @@ import 'package:shop_app/shared/network/styles/colors.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; import '../shared/cubits/onboarding_cubit/states.dart'; +// ignore: must_be_immutable class OnboardingScreen extends StatelessWidget { List onBoardInfo = [ OnboardingModel( @@ -23,6 +24,8 @@ class OnboardingScreen extends StatelessWidget { 'assets/images/iii.png'), ]; + OnboardingScreen({super.key}); + @override Widget build(BuildContext context) { PageController pageController = PageController(); @@ -38,7 +41,7 @@ class OnboardingScreen extends StatelessWidget { Expanded( flex: 4, child: PageView.builder( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), controller: pageController, itemBuilder: (context, index) => onboardBuildPage(onBoardInfo[index]), @@ -46,8 +49,9 @@ class OnboardingScreen extends StatelessWidget { onPageChanged: (index) { if (index == onBoardInfo.length - 1) { OnBoardingCubit.get(context).listenPageLastIndex(true); - } else + } else { OnBoardingCubit.get(context).listenPageLastIndex(false); + } }, ), ), @@ -71,7 +75,7 @@ class OnboardingScreen extends StatelessWidget { dotWidth: 10.0.sp, ), ), - Spacer(), + const Spacer(), Row( children: [ //Skip @@ -79,7 +83,7 @@ class OnboardingScreen extends StatelessWidget { onPressed: () { CacheHelper.saveData( key: 'onboardingIsSeen', value: true); - navigateAndRemove(context, LoginScreen()); + navigateAndRemove(context, const LoginScreen()); }, child: Text( 'SKIP', @@ -89,17 +93,17 @@ class OnboardingScreen extends StatelessWidget { ), ), ), - Spacer(), + const Spacer(), MaterialButton( padding: EdgeInsets.all(10.0.sp), onPressed: () { if (OnBoardingCubit.get(context).isLastPage) { CacheHelper.saveData( key: 'onboardingIsSeen', value: true); - navigateAndRemove(context, LoginScreen()); + navigateAndRemove(context, const LoginScreen()); } else { pageController.nextPage( - duration: Duration(milliseconds: 1000), + duration: const Duration(milliseconds: 1000), curve: Curves.fastLinearToSlowEaseIn, ); } @@ -109,7 +113,7 @@ class OnboardingScreen extends StatelessWidget { ? RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0.sp)) - : CircleBorder(), + : const CircleBorder(), child: OnBoardingCubit.get(context).isLastPage ? Text( 'Get Started', @@ -143,7 +147,7 @@ class OnboardingScreen extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 40.0.h), child: Image.asset( - '${pageInfo.imagePath}', + pageInfo.imagePath, ), ), @@ -153,7 +157,7 @@ class OnboardingScreen extends StatelessWidget { child: Column( children: [ Text( - '${pageInfo.title}', + pageInfo.title, textAlign: TextAlign.center, style: TextStyle( color: blue, @@ -162,7 +166,7 @@ class OnboardingScreen extends StatelessWidget { ), ), Text( - '${pageInfo.describtion}', + pageInfo.describtion, textAlign: TextAlign.center, style: TextStyle( color: black, diff --git a/lib/modules/products_screen.dart b/lib/modules/products_screen.dart index b3e65ad..a8bcb44 100644 --- a/lib/modules/products_screen.dart +++ b/lib/modules/products_screen.dart @@ -12,6 +12,7 @@ import 'package:shop_app/shared/cubits/home_cubit/home_states.dart'; import 'package:shop_app/shared/network/styles/colors.dart'; class ProductsScreen extends StatelessWidget { + const ProductsScreen({super.key}); @override Widget build(BuildContext context) { @@ -39,8 +40,7 @@ class ProductsScreen extends StatelessWidget { }, builder: (context, state) { return ConditionalBuilder( - condition: HomeCubit.get(context).homeDataModel != null && - HomeCubit.get(context).categoryModel != null, + condition: HomeCubit.get(context).homeDataModel != null, builder: (context) => productsBuilder( HomeCubit.get(context).homeDataModel, HomeCubit.get(context).categoryModel, @@ -60,103 +60,101 @@ class ProductsScreen extends StatelessWidget { padding: const EdgeInsets.symmetric( horizontal: 20.0, ), - child: Container( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CarouselSlider( - items: homeDataModel?.data.banners.map((e) { - return CachedNetworkImage( - imageUrl: e.image, - fit: BoxFit.cover, - errorWidget: (context, url, error) => - Icon(Icons.error_outline), - ); - }).toList(), - options: CarouselOptions( - height: screenHeight / 3.5, - autoPlayAnimationDuration: Duration(seconds: 1), - autoPlayCurve: Curves.fastOutSlowIn, - autoPlay: true, - autoPlayInterval: Duration(seconds: 4), - enableInfiniteScroll: true, - initialPage: 0, - reverse: false, - viewportFraction: 1.0, - ), - ), - SizedBox( - height: 20.h, - ), - //Categories - Text( - 'Categories', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 24.0.sp, - color: cubit.isDark ? Colors.white : Colors.black, - ), + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CarouselSlider( + items: homeDataModel?.data.banners.map((e) { + return CachedNetworkImage( + imageUrl: e.image, + fit: BoxFit.cover, + errorWidget: (context, url, error) => + const Icon(Icons.error_outline), + ); + }).toList(), + options: CarouselOptions( + height: screenHeight / 3.5, + autoPlayAnimationDuration: const Duration(seconds: 1), + autoPlayCurve: Curves.fastOutSlowIn, + autoPlay: true, + autoPlayInterval: const Duration(seconds: 4), + enableInfiniteScroll: true, + initialPage: 0, + reverse: false, + viewportFraction: 1.0, ), - SizedBox( - height: 10.0.h, + ), + SizedBox( + height: 20.h, + ), + //Categories + Text( + 'Categories', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 24.0.sp, + color: cubit.isDark ? Colors.white : Colors.black, ), - Container( - height: 90.0.h, - child: ListView.separated( - physics: BouncingScrollPhysics(), - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) => - categoryItemBuilder(categoryModel.data.data![index]), - separatorBuilder: (context, index) => SizedBox( - width: 10.0.w, - ), - itemCount: categoryModel.data.data!.length, + ), + SizedBox( + height: 10.0.h, + ), + SizedBox( + height: 90.0.h, + child: ListView.separated( + physics: const BouncingScrollPhysics(), + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) => + categoryItemBuilder(categoryModel.data.data![index]), + separatorBuilder: (context, index) => SizedBox( + width: 10.0.w, ), + itemCount: categoryModel.data.data!.length, ), - SizedBox( - height: 20.0.h, - ), - //products - Text( - 'New Products', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 24.0.sp, - color: cubit.isDark ? Colors.white : Colors.black), + ), + SizedBox( + height: 20.0.h, + ), + //products + Text( + 'New Products', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 24.0.sp, + color: cubit.isDark ? Colors.white : Colors.black), + ), + SizedBox( + height: 10.0.h, + ), + GridView.builder( + gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( + mainAxisExtent: 235.0.h, + maxCrossAxisExtent: 300.0, + crossAxisSpacing: 10.h, + mainAxisSpacing: 10.h, ), - SizedBox( - height: 10.0.h, + itemBuilder: (context, index) => gridProductBuilder( + homeDataModel.data.products[index], + context, ), - GridView.builder( - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - mainAxisExtent: 235.0.h, - maxCrossAxisExtent: 300.0, - crossAxisSpacing: 10.h, - mainAxisSpacing: 10.h, - ), - itemBuilder: (context, index) => gridProductBuilder( - homeDataModel.data.products[index], - context, - ), - itemCount: homeDataModel!.data.products.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - ) - // GridView.count( - // physics: NeverScrollableScrollPhysics(), - // crossAxisCount: 2, - // shrinkWrap: true, - // mainAxisSpacing: 10.0.h, - // crossAxisSpacing: 10.0.w, - // childAspectRatio: 1 / key.currentContext!.size!.height, - // children: List.generate(homeDataModel!.data.products.length, - // (index) => gridProductBuilder(homeDataModel.data.products[index], context), - // ), - // ) - ], - ), + itemCount: homeDataModel!.data.products.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + ) + // GridView.count( + // physics: NeverScrollableScrollPhysics(), + // crossAxisCount: 2, + // shrinkWrap: true, + // mainAxisSpacing: 10.0.h, + // crossAxisSpacing: 10.0.w, + // childAspectRatio: 1 / key.currentContext!.size!.height, + // children: List.generate(homeDataModel!.data.products.length, + // (index) => gridProductBuilder(homeDataModel.data.products[index], context), + // ), + // ) + ], ), ), ); @@ -183,7 +181,7 @@ class ProductsScreen extends StatelessWidget { CachedNetworkImage( imageUrl: product.image, errorWidget: (context, url, error) => - Icon(Icons.error_outline), + const Icon(Icons.error_outline), height: 150.0.h, width: double.infinity, ), @@ -191,7 +189,7 @@ class ProductsScreen extends StatelessWidget { Padding( padding: const EdgeInsets.all(5.0), child: Container( - padding: EdgeInsets.all(2.0), + padding: const EdgeInsets.all(2.0), decoration: BoxDecoration( color: blue, borderRadius: BorderRadius.circular( @@ -248,25 +246,25 @@ class ProductsScreen extends StatelessWidget { color: cubit.isDark ? Colors.white : Colors.black, ), ), - SizedBox( + const SizedBox( height: 5.0, ), Row( children: [ Text( - product.price.round().toString() + ' EGP', + '${product.price.round()} EGP', style: TextStyle( fontSize: 15.0.sp, color: orange, ), ), - SizedBox( + const SizedBox( width: 5.0, ), if (product.price != product.oldPrice) Expanded( child: Text( - product.oldPrice.round().toString() + ' EGP', + '${product.oldPrice.round()} EGP', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -287,14 +285,14 @@ class ProductsScreen extends StatelessWidget { ); } - Widget categoryItemBuilder(DataModel_C category) { + Widget categoryItemBuilder(DataModelC category) { return Container( - padding: EdgeInsets.only(bottom: 5.0), + padding: const EdgeInsets.only(bottom: 5.0), child: Material( elevation: 3.0, borderRadius: BorderRadius.circular(20.0), clipBehavior: Clip.hardEdge, - child: Container( + child: SizedBox( height: 90.0.h, width: 90.0.h, child: Stack( @@ -302,7 +300,8 @@ class ProductsScreen extends StatelessWidget { children: [ CachedNetworkImage( imageUrl: category.image, - errorWidget: (context, url, error) => Icon(Icons.error_outline), + errorWidget: (context, url, error) => + const Icon(Icons.error_outline), fit: BoxFit.cover, height: 90.0.h, width: 90.0.h, diff --git a/lib/modules/search_screen.dart b/lib/modules/search_screen.dart index fd2737a..d286f02 100644 --- a/lib/modules/search_screen.dart +++ b/lib/modules/search_screen.dart @@ -11,6 +11,8 @@ import '../models/home_data_model.dart'; import '../shared/network/styles/colors.dart'; class SearchScreen extends StatelessWidget { + const SearchScreen({super.key}); + @override Widget build(BuildContext context) { return BlocConsumer( @@ -27,29 +29,33 @@ class SearchScreen extends StatelessWidget { child: Column( children: [ defaultTFF( - text: 'Search', - prefixIcon: CupertinoIcons.search, - onSubmit: (String text) - { + text: 'Search', + prefixIcon: CupertinoIcons.search, + onSubmit: (String text) { cubit.getSearch(text); - } + }), + SizedBox( + height: 10.0.h, ), - SizedBox(height: 10.0.h,), if (state is GetSearchLoading) - LinearProgressIndicator(color: blue,), - SizedBox(height: 10.0.h,), - if(cubit.searchModel != null) + LinearProgressIndicator( + color: blue, + ), + SizedBox( + height: 10.0.h, + ), + if (cubit.searchModel != null) Expanded( - child: ListView.separated( - physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => searchItemBuilder( - cubit.searchModel!.products[index], context), - separatorBuilder: (context, index) => SizedBox( - height: 20.0.h, - ), - itemCount: cubit.searchModel!.products.length, + child: ListView.separated( + physics: const BouncingScrollPhysics(), + itemBuilder: (context, index) => searchItemBuilder( + cubit.searchModel!.products[index], context), + separatorBuilder: (context, index) => SizedBox( + height: 20.0.h, ), + itemCount: cubit.searchModel!.products.length, ), + ), ], ), ), @@ -109,7 +115,7 @@ class SearchScreen extends StatelessWidget { ), ], ), - Spacer(), + const Spacer(), Padding( padding: EdgeInsets.only( bottom: 10.0.h, @@ -117,7 +123,7 @@ class SearchScreen extends StatelessWidget { child: Row( children: [ Text( - product.price.toString() + ' EGP', + '${product.price} EGP', style: TextStyle( color: orange, fontSize: 18.0.sp, diff --git a/lib/modules/settings_screen.dart b/lib/modules/settings_screen.dart index 3d5ba53..129f57c 100644 --- a/lib/modules/settings_screen.dart +++ b/lib/modules/settings_screen.dart @@ -12,9 +12,12 @@ import 'package:shop_app/shared/cubits/home_cubit/home_states.dart'; import 'package:shop_app/shared/network/styles/colors.dart'; import '../shared/network/local/cache_helper.dart'; +// ignore: must_be_immutable class SettingsScreen extends StatelessWidget { late Offset offset; + SettingsScreen({super.key}); + @override Widget build(BuildContext context) { return BlocConsumer( @@ -25,8 +28,8 @@ class SettingsScreen extends StatelessWidget { return ConditionalBuilder( condition: cubit.profileModel != null, builder: (context) => SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( + physics: const BouncingScrollPhysics(), + child: SizedBox( width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -153,7 +156,7 @@ class SettingsScreen extends StatelessWidget { ), Padding( padding: EdgeInsets.symmetric(horizontal: 20.0.w), - child: Container( + child: SizedBox( width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -181,7 +184,7 @@ class SettingsScreen extends StatelessWidget { : Colors.black, ), ), - Spacer(), + const Spacer(), InkWell( onTap: () async { await showMenu( @@ -278,7 +281,7 @@ class SettingsScreen extends StatelessWidget { : Colors.black, ), ), - Spacer(), + const Spacer(), Padding( padding: EdgeInsets.all(12.0.h), child: Transform.scale( @@ -289,8 +292,9 @@ class SettingsScreen extends StatelessWidget { cubit.changeThemeMode(state); }, activeColor: orange, - thumbColor: - cubit.isDark ? asmarFate7 : Colors.white, + thumbColor: cubit.isDark + ? asmarFate7 + : Colors.white, ), ), ), @@ -336,13 +340,13 @@ class SettingsScreen extends StatelessWidget { color: cubit.isDark ? Colors.white : Colors.black, ), ), - Spacer(), + const Spacer(), InkWell( borderRadius: BorderRadius.circular(10.0.sp), highlightColor: cubit.isDark ? asmarFate7 : offWhite, onTap: () { CacheHelper.removeData(key: 'token'); - navigateAndRemove(context, LoginScreen()); + navigateAndRemove(context, const LoginScreen()); }, child: Container( padding: EdgeInsets.all(10.0.sp), diff --git a/lib/modules/sign_up.dart b/lib/modules/sign_up.dart index dba4c5b..22b9348 100644 --- a/lib/modules/sign_up.dart +++ b/lib/modules/sign_up.dart @@ -10,6 +10,7 @@ import '../layout/home_layout.dart'; import '../shared/components/components.dart'; import '../shared/network/styles/colors.dart'; +// ignore: must_be_immutable class SignUpScreen extends StatelessWidget { TextEditingController emailController = TextEditingController(); TextEditingController passwordController = TextEditingController(); @@ -17,6 +18,8 @@ class SignUpScreen extends StatelessWidget { TextEditingController nameController = TextEditingController(); var formKey = GlobalKey(); + SignUpScreen({super.key}); + @override Widget build(BuildContext context) { return BlocConsumer( @@ -34,7 +37,7 @@ class SignUpScreen extends StatelessWidget { HomeCubit.get(context).getProfileData(); HomeCubit.get(context).getHomeData(); HomeCubit.get(context).getFavorites(); - navigateAndRemove(context, HomeLayout()); + navigateAndRemove(context, const HomeLayout()); } } }, @@ -53,7 +56,7 @@ class SignUpScreen extends StatelessWidget { children: [ Expanded( child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), child: Form( key: formKey, child: Column( @@ -91,8 +94,10 @@ class SignUpScreen extends StatelessWidget { keyboardType: TextInputType.text, prefixIcon: Icons.person, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter Your Name'; + } + return null; }), SizedBox( height: 20.0.h, @@ -104,8 +109,10 @@ class SignUpScreen extends StatelessWidget { keyboardType: TextInputType.emailAddress, prefixIcon: Icons.alternate_email, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter an Email'; + } + return null; }), SizedBox( height: 20.0.h, @@ -121,8 +128,10 @@ class SignUpScreen extends StatelessWidget { cubit.changeVisibility(); }, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter your password'; + } + return null; }), SizedBox( height: 20.0.h, @@ -133,8 +142,10 @@ class SignUpScreen extends StatelessWidget { keyboardType: TextInputType.phone, prefixIcon: Icons.phone, validate: (value) { - if (value != null && value == '') + if (value != null && value == '') { return 'Please, Enter Your Phone Number'; + } + return null; }), SizedBox( height: 40.0.h, @@ -165,7 +176,7 @@ class SignUpScreen extends StatelessWidget { fontSize: 14.0.sp, ), ), - SizedBox( + const SizedBox( width: 5.0, ), Icon( diff --git a/lib/shared/components/components.dart b/lib/shared/components/components.dart index 181bc1c..9b805d1 100644 --- a/lib/shared/components/components.dart +++ b/lib/shared/components/components.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -10,11 +9,16 @@ import '../network/styles/colors.dart'; void navigateAndRemove(context, widget) => Navigator.pushAndRemoveUntil( context, - MaterialPageRoute(builder: (context) => widget,), - (route) => false); + MaterialPageRoute( + builder: (context) => widget, + ), + (route) => false); -void navigateTo(context, widget) => Navigator.push(context, - MaterialPageRoute(builder: (context) => widget,)); +void navigateTo(context, widget) => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => widget, + )); Widget defaultTFF({ TextEditingController? controller, @@ -28,8 +32,7 @@ Widget defaultTFF({ bool isObscure = false, Function()? onTap, Function(String)? onSubmit, -}) -{ +}) { return BlocConsumer( listener: (context, state) {}, builder: (context, state) { @@ -44,51 +47,54 @@ Widget defaultTFF({ obscureText: isObscure, maxLines: 1, style: TextStyle( - color: cubit.isDark? Colors.white : Colors.black, + color: cubit.isDark ? Colors.white : Colors.black, fontSize: 16.0.sp, ), decoration: InputDecoration( focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(20.0.sp), - borderSide: BorderSide(style: BorderStyle.none), + borderSide: const BorderSide(style: BorderStyle.none), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(20.0.sp), - borderSide: BorderSide(style: BorderStyle.none), + borderSide: const BorderSide(style: BorderStyle.none), ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(20.0.sp), - borderSide: BorderSide(style: BorderStyle.none), + borderSide: const BorderSide(style: BorderStyle.none), ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(20.0.sp), - borderSide: BorderSide(style: BorderStyle.none),), - hintText: text, - hintStyle: TextStyle( - color: metal, - fontSize: 16.0.sp + borderSide: const BorderSide(style: BorderStyle.none), ), + hintText: text, + hintStyle: TextStyle(color: metal, fontSize: 16.0.sp), filled: true, - fillColor: cubit.isDark? asmarFate7 : offWhite, + fillColor: cubit.isDark ? asmarFate7 : offWhite, prefixIcon: Padding( padding: EdgeInsets.only(left: 5.0.w, right: 5.0.w), child: Icon( prefixIcon, - color: cubit.isDark? skin : Colors.black54, + color: cubit.isDark ? skin : Colors.black54, size: 24.0.sp, ), ), suffixIcon: Padding( - padding: EdgeInsets.only(right: 5.0.w,), + padding: EdgeInsets.only( + right: 5.0.w, + ), child: ClipRRect( borderRadius: BorderRadius.circular(25.0.sp), child: Material( color: Colors.transparent, child: IconButton( - padding: EdgeInsets.all(0.0), + padding: const EdgeInsets.all(0.0), onPressed: onPressedSuffix, - icon: Icon(suffixIcon, size: 22.0.sp,), - color: cubit.isDark? skin : Colors.black54, + icon: Icon( + suffixIcon, + size: 22.0.sp, + ), + color: cubit.isDark ? skin : Colors.black54, ), ), ), @@ -101,41 +107,43 @@ Widget defaultTFF({ } Widget login(context) => Text( - 'Login', - style: TextStyle( - color: HomeCubit.get(context).isDark ? Colors.white : Colors.black, - fontSize: 36.0.sp, - fontWeight: FontWeight.w700, - ), -); + 'Login', + style: TextStyle( + color: HomeCubit.get(context).isDark ? Colors.white : Colors.black, + fontSize: 36.0.sp, + fontWeight: FontWeight.w700, + ), + ); Widget askToCreate(context) => Text( - "Don't have an account?", - style: TextStyle( - color: HomeCubit.get(context).isDark ? skin : Colors.black, - fontSize: 14.0.sp - ), -); + "Don't have an account?", + style: TextStyle( + color: HomeCubit.get(context).isDark ? skin : Colors.black, + fontSize: 14.0.sp), + ); Widget defaultButton({ required Function() onPressed, Widget? child, -}) => MaterialButton( - onPressed: onPressed, - highlightColor: Colors.orange, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), - padding: EdgeInsets.symmetric(horizontal: 15.0.w, vertical: 7.5.h,), - child: child, - color: orange, -); +}) => + MaterialButton( + onPressed: onPressed, + highlightColor: Colors.orange, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), + padding: EdgeInsets.symmetric( + horizontal: 15.0.w, + vertical: 7.5.h, + ), + color: orange, + child: child, + ); void defaultToast({ required BuildContext context, required String message, required Color iconColor, required IconData icon, -}) -{ +}) { MotionToast( description: Text( message, @@ -145,17 +153,19 @@ void defaultToast({ ), ), primaryColor: HexColor('DEDEDE'), - animationDuration: Duration(milliseconds: 500,), - toastDuration: Duration(seconds: 5), + animationDuration: const Duration( + milliseconds: 500, + ), + toastDuration: const Duration(seconds: 5), displaySideBar: false, icon: icon, animationCurve: Curves.fastLinearToSlowEaseIn, secondaryColor: iconColor, enableAnimation: false, - constraints: BoxConstraints(), + constraints: const BoxConstraints(), padding: EdgeInsets.all(20.0.sp), - ).show(context); - } + ).show(context); +} Widget logo = Row( children: [ @@ -166,10 +176,7 @@ Widget logo = Row( ), Text( 'BuyMe', - style: TextStyle( - fontSize: 24.0.sp, - fontWeight: FontWeight.w500 - ), + style: TextStyle(fontSize: 24.0.sp, fontWeight: FontWeight.w500), ), ], ); @@ -177,8 +184,7 @@ Widget logo = Row( Widget loading = SizedBox( width: 35.0.sp, height: 35.0.sp, - child: CircularProgressIndicator( color: orange, ), -); \ No newline at end of file +); diff --git a/lib/shared/cubits/home_cubit/home_cubit.dart b/lib/shared/cubits/home_cubit/home_cubit.dart index 1501a20..3a68716 100644 --- a/lib/shared/cubits/home_cubit/home_cubit.dart +++ b/lib/shared/cubits/home_cubit/home_cubit.dart @@ -1,8 +1,6 @@ -import 'package:bloc/bloc.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shop_app/models/category_model.dart'; import 'package:shop_app/models/favorite_model.dart'; import 'package:shop_app/models/get_favorites_model.dart'; @@ -27,7 +25,7 @@ class HomeCubit extends Cubit { List navItems = [ BottomNavigationBarItem( - icon: Icon(Icons.home_outlined), + icon: const Icon(Icons.home_outlined), label: 'Home', activeIcon: Icon( Icons.home, @@ -35,7 +33,7 @@ class HomeCubit extends Cubit { ), ), BottomNavigationBarItem( - icon: Icon(Icons.category_outlined), + icon: const Icon(Icons.category_outlined), label: 'Category', activeIcon: Icon( Icons.category, @@ -43,7 +41,7 @@ class HomeCubit extends Cubit { ), ), BottomNavigationBarItem( - icon: Icon( + icon: const Icon( Icons.favorite_outline, ), label: 'Favorites', @@ -52,7 +50,7 @@ class HomeCubit extends Cubit { color: orange, )), BottomNavigationBarItem( - icon: Icon(Icons.settings_outlined), + icon: const Icon(Icons.settings_outlined), label: 'Settings', activeIcon: Icon( Icons.settings, @@ -62,9 +60,9 @@ class HomeCubit extends Cubit { ]; List screens = [ - ProductsScreen(), - CategoryScreen(), - FavoritesScreen(), + const ProductsScreen(), + const CategoryScreen(), + const FavoritesScreen(), SettingsScreen(), ]; @@ -75,20 +73,19 @@ class HomeCubit extends Cubit { emit(ChangeHomeNavIndexState()); } - HomeDataModel? homeDataModel = null; + HomeDataModel? homeDataModel; void getHomeData() { emit(GetHomeDataLoadingSate()); DioHelper.getData( - method: HOME, + method: kHOME, token: CacheHelper.getData(key: 'token'), lang: CacheHelper.getData(key: 'lang') ?? 'en', ).then((response) { homeDataModel = HomeDataModel.fromJson(response.data); emit(GetHomeDataSuccessSate()); }).catchError((error) { - print(error.toString()); emit(GetHomeDataErrorSate()); }); } @@ -97,13 +94,12 @@ class HomeCubit extends Cubit { void getCategoryData() { DioHelper.getData( - method: GET_CATEGORY, + method: kGetCATEGORY, lang: CacheHelper.getData(key: 'lang') ?? 'en') .then((response) { categoryModel = CategoryModel.fromJson(response.data); emit(GetCategorySuccessSate()); }).catchError((error) { - print(error.toString()); emit(GetCategoryErrorSate()); }); } @@ -114,7 +110,7 @@ class HomeCubit extends Cubit { emit(ChangeFavState()); DioHelper.postData( - method: CHANGE_FAV, + method: kChangeFAV, data: { 'product_id': id, }, @@ -134,7 +130,7 @@ class HomeCubit extends Cubit { void getFavorites() { DioHelper.getData( - method: CHANGE_FAV, + method: kChangeFAV, token: CacheHelper.getData(key: 'token'), lang: CacheHelper.getData(key: 'lang') ?? 'en', ).then((response) { @@ -142,7 +138,6 @@ class HomeCubit extends Cubit { emit(GetFavSuccessState()); }).catchError((error) { emit(GetFavErrorState()); - print(error.toString()); }); } @@ -153,18 +148,17 @@ class HomeCubit extends Cubit { emit(ChangeThemeMode()); } - ProfileModel? profileModel = null; + ProfileModel? profileModel; void getProfileData() { DioHelper.getData( - method: GET_PROFILE, + method: kGetPROFILE, token: CacheHelper.getData(key: 'token'), lang: CacheHelper.getData(key: 'lang') ?? 'en', ).then((response) { profileModel = ProfileModel.fromJson(response.data); emit(GetProfileSuccessState()); }).catchError((error) { - print(error.toString()); emit(GetProfileErrorState()); }); } @@ -187,7 +181,7 @@ class HomeCubit extends Cubit { emit(UpdateProfileLoadingState()); DioHelper.putData( - method: UPDATE_PROFILE, + method: kUpdatePROFILE, data: { 'name': name, 'password': password, @@ -230,7 +224,7 @@ class HomeCubit extends Cubit { emit(SignUpLoadingState()); DioHelper.postData( - method: SIGN_UP, + method: kSignUp, data: { "name": name, "phone": phone, @@ -259,13 +253,13 @@ class HomeCubit extends Cubit { emit(ChangeLanguage()); } - SearchModel? searchModel = null; + SearchModel? searchModel; void getSearch(String text) { emit(GetSearchLoading()); DioHelper.postData( - method: SEARCH, + method: kSEARCH, data: { "text": text, }, diff --git a/lib/shared/cubits/login_cubit/login_cubit.dart b/lib/shared/cubits/login_cubit/login_cubit.dart index fe37892..c83d883 100644 --- a/lib/shared/cubits/login_cubit/login_cubit.dart +++ b/lib/shared/cubits/login_cubit/login_cubit.dart @@ -1,4 +1,3 @@ -import 'package:bloc/bloc.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:shop_app/modules/login_model.dart'; @@ -6,8 +5,7 @@ import 'package:shop_app/shared/cubits/login_cubit/login_states.dart'; import 'package:shop_app/shared/network/end_points.dart'; import 'package:shop_app/shared/network/remote/dio.dart'; -class LoginCubit extends Cubit -{ +class LoginCubit extends Cubit { LoginCubit() : super(LoginInitialState()); static LoginCubit get(context) => BlocProvider.of(context); @@ -15,36 +13,33 @@ class LoginCubit extends Cubit bool isObscure = true; IconData passwordSuffixIcon = Icons.visibility_outlined; - void changeVisibilityMode() - { + void changeVisibilityMode() { isObscure = !isObscure; - passwordSuffixIcon = isObscure ? Icons.visibility_outlined : Icons.visibility_off_outlined; + passwordSuffixIcon = + isObscure ? Icons.visibility_outlined : Icons.visibility_off_outlined; emit(ChangeVisibilityState()); } late LoginModel loginModel; - void LogIn({ - required String email, - required String password, -}) - { + void logIn({ + required String email, + required String password, + }) { emit(LoginLoadingState()); - + DioHelper.postData( - method: LOGIN, + method: kLogin, data: { - "email" : email, - "password" : password, + "email": email, + "password": password, }, lang: 'en', ).then((value) { loginModel = LoginModel.fromJson(value.data); emit(LoginSuccessState(loginModel)); - }).catchError((error) { - print('error : ' + error.toString()); emit(LoginErrorState()); }); } -} \ No newline at end of file +} diff --git a/lib/shared/cubits/onboarding_cubit/cubit.dart b/lib/shared/cubits/onboarding_cubit/cubit.dart index a164996..f95fb55 100644 --- a/lib/shared/cubits/onboarding_cubit/cubit.dart +++ b/lib/shared/cubits/onboarding_cubit/cubit.dart @@ -1,18 +1,15 @@ -import 'package:bloc/bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:shop_app/shared/cubits/onboarding_cubit/states.dart'; -class OnBoardingCubit extends Cubit -{ +class OnBoardingCubit extends Cubit { OnBoardingCubit() : super(InitialState()); static OnBoardingCubit get(context) => BlocProvider.of(context); bool isLastPage = false; - void listenPageLastIndex(bool isLast) - { + void listenPageLastIndex(bool isLast) { isLastPage = isLast; emit(ChangePageLastIndexState()); } -} \ No newline at end of file +} diff --git a/lib/shared/network/end_points.dart b/lib/shared/network/end_points.dart index b41350b..a982b7c 100644 --- a/lib/shared/network/end_points.dart +++ b/lib/shared/network/end_points.dart @@ -1,8 +1,8 @@ -const String LOGIN = 'login'; -const String HOME = 'home'; -const String GET_CATEGORY = 'categories'; -const String CHANGE_FAV = 'favorites'; -const String GET_PROFILE = 'profile'; -const String UPDATE_PROFILE = 'update-profile'; -const String SIGN_UP = 'register'; -const String SEARCH = 'products/search'; \ No newline at end of file +const String kLogin = 'login'; +const String kHOME = 'home'; +const String kGetCATEGORY = 'categories'; +const String kChangeFAV = 'favorites'; +const String kGetPROFILE = 'profile'; +const String kUpdatePROFILE = 'update-profile'; +const String kSignUp = 'register'; +const String kSEARCH = 'products/search'; diff --git a/lib/shared/network/local/cache_helper.dart b/lib/shared/network/local/cache_helper.dart index f5e0b7a..61bc1c1 100644 --- a/lib/shared/network/local/cache_helper.dart +++ b/lib/shared/network/local/cache_helper.dart @@ -1,38 +1,32 @@ import 'package:shared_preferences/shared_preferences.dart'; -class CacheHelper -{ +class CacheHelper { static late SharedPreferences sharedPreferences; - static init() async - { + static init() async { sharedPreferences = await SharedPreferences.getInstance(); } static Future saveData({ - required String key, - required dynamic value, -}) async - { - if (value is String) + required String key, + required dynamic value, + }) async { + if (value is String) { return await sharedPreferences.setString(key, value); - else if(value is int) + } else if (value is int) { return await sharedPreferences.setInt(key, value); - else if(value is bool) + } else if (value is bool) { return await sharedPreferences.setBool(key, value); + } return await sharedPreferences.setDouble(key, value); } - static dynamic getData ({required String key}) - { + static dynamic getData({required String key}) { return sharedPreferences.get(key); } - static Future removeData({required String key}) async - { + static Future removeData({required String key}) async { return await sharedPreferences.remove(key); } - } - diff --git a/lib/shared/network/styles/styles.dart b/lib/shared/network/styles/styles.dart index 30b449a..d568d54 100644 --- a/lib/shared/network/styles/styles.dart +++ b/lib/shared/network/styles/styles.dart @@ -4,7 +4,7 @@ import 'package:shop_app/shared/network/styles/colors.dart'; ThemeData lightTheme = ThemeData( fontFamily: 'Poppens', - appBarTheme: AppBarTheme( + appBarTheme: const AppBarTheme( titleTextStyle: TextStyle( color: Colors.black, ), @@ -30,10 +30,8 @@ ThemeData lightTheme = ThemeData( ThemeData darkTheme = ThemeData( fontFamily: 'Poppens', appBarTheme: AppBarTheme( - titleTextStyle: TextStyle( - color: Colors.white - ), - iconTheme: IconThemeData(color: Colors.white), + titleTextStyle: const TextStyle(color: Colors.white), + iconTheme: const IconThemeData(color: Colors.white), systemOverlayStyle: SystemUiOverlayStyle( statusBarColor: asmar, statusBarIconBrightness: Brightness.light, @@ -44,7 +42,7 @@ ThemeData darkTheme = ThemeData( scaffoldBackgroundColor: asmar, bottomNavigationBarTheme: BottomNavigationBarThemeData( backgroundColor: asmarFate7, - selectedLabelStyle: TextStyle( + selectedLabelStyle: const TextStyle( color: Colors.white, ), selectedItemColor: orange, @@ -52,4 +50,4 @@ ThemeData darkTheme = ThemeData( unselectedItemColor: skin, elevation: 0.0, ), -); \ No newline at end of file +); diff --git a/pubspec.lock b/pubspec.lock index de5e06f..dc1083b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,126 +5,144 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" bloc: dependency: "direct main" description: name: bloc - url: "https://pub.dartlang.org" + sha256: "658a5ae59edcf1e58aac98b000a71c762ad8f46f1394c34a52050cafb3e11a80" + url: "https://pub.dev" source: hosted version: "8.1.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" cached_network_image: dependency: "direct main" description: name: cached_network_image - url: "https://pub.dartlang.org" + sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 + url: "https://pub.dev" source: hosted version: "3.2.3" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" + sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 + url: "https://pub.dev" source: hosted version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - url: "https://pub.dartlang.org" + sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 + url: "https://pub.dev" source: hosted version: "1.0.2" carousel_slider: dependency: "direct main" description: name: carousel_slider - url: "https://pub.dartlang.org" + sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42" + url: "https://pub.dev" source: hosted version: "4.2.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.2" conditional_builder_null_safety: dependency: "direct main" description: name: conditional_builder_null_safety - url: "https://pub.dartlang.org" + sha256: "4428f40c20e222acead5e424fb9fba261733fc9da06ef58a08d9477207b0adfd" + url: "https://pub.dev" source: hosted version: "0.0.6" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + url: "https://pub.dev" source: hosted version: "0.3.3+4" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" source: hosted version: "3.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted version: "1.0.5" dio: dependency: "direct main" description: name: dio - url: "https://pub.dartlang.org" + sha256: "9fdbf71baeb250fc9da847f6cb2052196f62c19906a3657adfc18631a667d316" + url: "https://pub.dev" source: hosted version: "5.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted version: "6.1.4" flutter: @@ -136,44 +154,50 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.dartlang.org" + sha256: "434951eea948dbe87f737b674281465f610b8259c16c097b8163ce138749a775" + url: "https://pub.dev" source: hosted version: "8.1.2" flutter_blurhash: dependency: transitive description: name: flutter_blurhash - url: "https://pub.dartlang.org" + sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6" + url: "https://pub.dev" source: hosted version: "0.7.0" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - url: "https://pub.dartlang.org" + sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" + url: "https://pub.dev" source: hosted version: "3.3.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + url: "https://pub.dev" source: hosted version: "2.0.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "4bef634684b2c7f3468c77c766c831229af829a0cd2d4ee6c1b99558bd14e5d2" + url: "https://pub.dev" source: hosted version: "2.0.8" flutter_screenutil: dependency: "direct main" description: name: flutter_screenutil - url: "https://pub.dartlang.org" + sha256: "8cf100b8e4973dc570b6415a2090b0bfaa8756ad333db46939efc3e774ee100d" + url: "https://pub.dev" source: hosted - version: "5.6.1" + version: "5.9.0" flutter_test: dependency: "direct dev" description: flutter @@ -188,252 +212,288 @@ packages: dependency: "direct main" description: name: hexcolor - url: "https://pub.dartlang.org" + sha256: c07f4bbb9095df87eeca87e7c69e8c3d60f70c66102d7b8d61c4af0453add3f6 + url: "https://pub.dev" source: hosted version: "3.0.1" http: dependency: transitive description: name: http - url: "https://pub.dartlang.org" + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" source: hosted version: "0.13.5" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted version: "4.0.2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + sha256: "22207768556b82d55ec70166824350fee32298732d5efa4d6e756f848f51f66a" + url: "https://pub.dev" source: hosted version: "0.8.6+3" image_picker_android: dependency: transitive description: name: image_picker_android - url: "https://pub.dartlang.org" + sha256: "68d067baf7f6e401b1124ee83dd6967e67847314250fd68012aab34a69beb344" + url: "https://pub.dev" source: hosted version: "0.8.5+7" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - url: "https://pub.dartlang.org" + sha256: "66fc6e3877bbde82c33d122f3588777c3784ac5bd7d1cdd79213ef7aecb85b34" + url: "https://pub.dev" source: hosted version: "2.1.11" image_picker_ios: dependency: transitive description: name: image_picker_ios - url: "https://pub.dartlang.org" + sha256: "39aa70b5f1e5e7c94585b9738632d5fdb764a5655e40cd9e7b95fbd2fc50c519" + url: "https://pub.dev" source: hosted version: "0.8.6+9" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - url: "https://pub.dartlang.org" + sha256: "1991219d9dbc42a99aff77e663af8ca51ced592cd6685c9485e3458302d3d4f8" + url: "https://pub.dev" source: hosted version: "2.6.3" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + url: "https://pub.dev" source: hosted version: "0.6.4" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" source: hosted version: "2.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" motion_toast: dependency: "direct main" description: name: motion_toast - url: "https://pub.dartlang.org" + sha256: "4ceb09cbc85443b73262b9ff3f924c6129270730b251277f94e41c5c29cc0fa6" + url: "https://pub.dev" source: hosted version: "2.6.5" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" octo_image: dependency: transitive description: name: octo_image - url: "https://pub.dartlang.org" + sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" + url: "https://pub.dev" source: hosted version: "1.0.2" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_provider: dependency: transitive description: name: path_provider - url: "https://pub.dartlang.org" + sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9" + url: "https://pub.dev" source: hosted version: "2.0.13" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + sha256: "7623b7d4be0f0f7d9a8b5ee6879fc13e4522d4c875ab86801dee4af32b54b83e" + url: "https://pub.dev" source: hosted version: "2.0.23" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - url: "https://pub.dartlang.org" + sha256: eec003594f19fe2456ea965ae36b3fc967bc5005f508890aafe31fa75e41d972 + url: "https://pub.dev" source: hosted version: "2.1.2" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + sha256: "2e32f1640f07caef0d3cb993680f181c79e54a3827b997d5ee221490d131fbd9" + url: "https://pub.dev" source: hosted version: "2.1.8" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + url: "https://pub.dev" source: hosted version: "2.0.5" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + url: "https://pub.dev" source: hosted version: "2.1.3" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" + url: "https://pub.dev" source: hosted version: "1.11.1" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + url: "https://pub.dev" source: hosted version: "2.1.3" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" source: hosted version: "4.2.4" provider: dependency: transitive description: name: provider - url: "https://pub.dartlang.org" + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" source: hosted version: "6.0.5" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" source: hosted version: "0.27.7" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9" + url: "https://pub.dev" source: hosted version: "2.0.17" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7" + url: "https://pub.dev" source: hosted version: "2.0.15" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - url: "https://pub.dartlang.org" + sha256: "2b55c18636a4edc529fa5cd44c03d3f3100c00513f518c5127c951978efcccd0" + url: "https://pub.dev" source: hosted version: "2.1.3" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874 + url: "https://pub.dev" source: hosted version: "2.1.3" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + url: "https://pub.dev" source: hosted version: "2.1.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + url: "https://pub.dev" source: hosted version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9" + url: "https://pub.dev" source: hosted version: "2.1.3" sky_engine: @@ -445,107 +505,130 @@ packages: dependency: "direct main" description: name: smooth_page_indicator - url: "https://pub.dartlang.org" + sha256: "8c301bc686892306cd41672c1880167f140c16be305d5ede8201fefd9fcda829" + url: "https://pub.dev" source: hosted version: "1.0.1" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" sqflite: dependency: transitive description: name: sqflite - url: "https://pub.dartlang.org" + sha256: "78324387dc81df14f78df06019175a86a2ee0437624166c382e145d0a7fd9a4f" + url: "https://pub.dev" source: hosted version: "2.2.4+1" sqflite_common: dependency: transitive description: name: sqflite_common - url: "https://pub.dartlang.org" + sha256: bfd6973aaeeb93475bc0d875ac9aefddf7965ef22ce09790eb963992ffc5183f + url: "https://pub.dev" source: hosted version: "2.4.2+2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b" + url: "https://pub.dev" source: hosted version: "3.0.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.6.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" source: hosted version: "1.3.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" source: hosted version: "3.0.7" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" source: hosted version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + url: "https://pub.dev" source: hosted version: "1.0.0" sdks: - dart: ">=2.18.1 <3.0.0" - flutter: ">=3.3.0" + dart: ">=3.1.0-185.0.dev <4.0.0" + flutter: ">=3.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index c148d2e..38c789e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,30 +29,23 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: + bloc: ^8.1.1 + cached_network_image: ^3.2.3 + carousel_slider: ^4.2.1 + conditional_builder_null_safety: ^0.0.6 + cupertino_icons: ^1.0.2 + dio: ^5.0.0 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.2 - hexcolor: ^3.0.1 - smooth_page_indicator: ^1.0.1 flutter_bloc: ^8.1.2 - bloc: ^8.1.1 - dio: ^5.0.0 - conditional_builder_null_safety: ^0.0.6 + flutter_screenutil: ^5.9.0 + hexcolor: ^3.0.1 + image_picker: ^0.8.6+3 motion_toast: ^2.6.5 shared_preferences: ^2.0.17 - carousel_slider: ^4.2.1 - image_picker: ^0.8.6+3 - cached_network_image: ^3.2.3 - flutter_screenutil: ^5.6.1 - + smooth_page_indicator: ^1.0.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 @@ -60,53 +53,52 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^2.0.0 + flutter_test: + sdk: flutter # 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 - - assets: - - assets/images/ - - assets/ca/lets-encrypt-r3.pem - - fonts: - - family: Poppens - fonts: - - asset: assets/fonts/poppens/Poppins-Regular.ttf - - asset: assets/fonts/poppens/Poppins-Italic.ttf - style: italic - - asset: assets/fonts/poppens/Poppins-Bold.ttf - weight: 700 - - asset: assets/fonts/poppens/Poppins-Medium.ttf - weight: 300 - # - 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/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # 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: + uses-material-design: true + + assets: + - assets/images/ + - assets/ca/lets-encrypt-r3.pem + + fonts: + - family: Poppens + fonts: + - asset: assets/fonts/poppens/Poppins-Regular.ttf + - asset: assets/fonts/poppens/Poppins-Italic.ttf + style: italic + - asset: assets/fonts/poppens/Poppins-Bold.ttf + weight: 700 + - asset: assets/fonts/poppens/Poppins-Medium.ttf + weight: 300 + +# - 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/assets-and-images/#resolution-aware +# For details regarding adding assets from package dependencies, see +# https://flutter.dev/assets-and-images/#from-packages +# 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: # - asset: fonts/Schyler-Italic.ttf # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages +# - family: Trajan Pro +# fonts: +# - asset: fonts/TrajanPro.ttf +# - asset: fonts/TrajanPro_Bold.ttf +# weight: 700 +# +# For details regarding fonts from package dependencies, +# see https://flutter.dev/custom-fonts/#from-packages diff --git a/test/widget_test.dart b/test/widget_test.dart index 5ac7758..b01253a 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:shop_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); + await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget);