diff --git a/lib/main.dart b/lib/main.dart index cdafe0c1..f5671270 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,6 @@ import 'dart:convert'; import 'dart:developer'; - +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; @@ -77,31 +77,38 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { UiSizes.init(context); final themeController = Get.put(ThemeController()); + return ScreenUtilInit( + designSize: const Size(360, 690), + minTextAdapt: true, + splitScreenMode: true, + // Use builder only if you need to use library outside ScreenUtilInit context + builder: (_ , child) { + return Obx( + () => GetMaterialApp( + localizationsDelegates: [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + locale: Locale(languageLocale), + supportedLocales: AppLocalizations.supportedLocales, + debugShowCheckedModeBanner: false, + title: 'Resonate', + theme: ThemeModes.setLightTheme( + ThemeList.getThemeModel(themeController.currentTheme.value), + ), + darkTheme: ThemeModes.setDarkTheme( + ThemeList.getThemeModel(themeController.currentTheme.value), + ), + themeMode: ThemeList.getThemeModel( + themeController.currentTheme.value, + ).themeMode, + initialRoute: AppRoutes.splash, + getPages: AppPages.pages, + ), + ); + }); - return Obx( - () => GetMaterialApp( - localizationsDelegates: [ - AppLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - locale: Locale(languageLocale), - supportedLocales: AppLocalizations.supportedLocales, - debugShowCheckedModeBanner: false, - title: 'Resonate', - theme: ThemeModes.setLightTheme( - ThemeList.getThemeModel(themeController.currentTheme.value), - ), - darkTheme: ThemeModes.setDarkTheme( - ThemeList.getThemeModel(themeController.currentTheme.value), - ), - themeMode: ThemeList.getThemeModel( - themeController.currentTheme.value, - ).themeMode, - initialRoute: AppRoutes.splash, - getPages: AppPages.pages, - ), - ); } } diff --git a/lib/views/screens/category_screen.dart b/lib/views/screens/category_screen.dart index 8a4b652f..436858c7 100644 --- a/lib/views/screens/category_screen.dart +++ b/lib/views/screens/category_screen.dart @@ -6,6 +6,7 @@ import 'package:resonate/controllers/explore_story_controller.dart'; import 'package:resonate/utils/app_images.dart'; import 'package:resonate/views/widgets/category_card.dart'; import 'package:resonate/views/widgets/story_list_tile.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class CategoryScreen extends StatelessWidget { CategoryScreen({super.key, required this.categoryName}); @@ -19,7 +20,8 @@ class CategoryScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - automaticallyImplyLeading: false, + automaticallyImplyLeading: true, //back button for user experience + centerTitle: true, backgroundColor: Theme.of(context).colorScheme.surface, elevation: 0, title: Text(capitalizeFirstLetter(categoryName)), @@ -28,8 +30,8 @@ class CategoryScreen extends StatelessWidget { () => exploreStoryController.isLoadingCategoryPage.value ? Center( child: SizedBox( - height: 200, - width: 200, + height: 200.r, + width: 200.r, child: LoadingIndicator( indicatorType: Indicator.ballRotate, colors: [Theme.of(context).colorScheme.primary], @@ -38,13 +40,9 @@ class CategoryScreen extends StatelessWidget { ) : exploreStoryController.openedCategotyStories.isNotEmpty ? Padding( - padding: const EdgeInsets.only(top: 20.0), + padding: EdgeInsets.only(top: 20.h), child: ListView.builder( - physics: const NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, padding: EdgeInsets.zero, - shrinkWrap: true, - primary: true, itemCount: exploreStoryController.openedCategotyStories.length, itemBuilder: (context, index) { @@ -56,27 +54,27 @@ class CategoryScreen extends StatelessWidget { }, ), ) - : Padding( - padding: const EdgeInsets.only(bottom: 150.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - height: 200, - width: 200, - AppImages.emptyBoxImage, - ), - const SizedBox(height: 20), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 30.0), - child: Text( + : Center( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 30.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + height: 200.r, + width: 200.r, + AppImages.emptyBoxImage, + ), + SizedBox(height: 20.h), + Text( AppLocalizations.of(context)!.noStoriesInCategory( capitalizeFirstLetter(categoryName), ), textAlign: TextAlign.center, ), - ), - ], + ], + ), ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 978d8920..bab2c655 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,6 +29,7 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run flutter pub outdated. dependencies: + flutter_screenutil: ^5.9.3 animated_bottom_navigation_bar: ^1.4.0 animated_splash_screen: ^1.3.0 app_links: ^6.4.1