Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,38 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
UiSizes.init(context);
final themeController = Get.put(ThemeController());
return ScreenUtilInit(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for these changes, use layout builder and media query in category screen itself

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,
),
);
}
}
46 changes: 22 additions & 24 deletions lib/views/screens/category_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead use Media query and Layout builder


class CategoryScreen extends StatelessWidget {
CategoryScreen({super.key, required this.categoryName});
Expand All @@ -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)),
Expand All @@ -28,8 +30,8 @@ class CategoryScreen extends StatelessWidget {
() => exploreStoryController.isLoadingCategoryPage.value
? Center(
child: SizedBox(
height: 200,
width: 200,
height: 200.h,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use media query and layout builder

width: 200.w,
child: LoadingIndicator(
indicatorType: Indicator.ballRotate,
colors: [Theme.of(context).colorScheme.primary],
Expand All @@ -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) {
Expand All @@ -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.0.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
height: 200.h,
width: 200.w,
AppImages.emptyBoxImage,
),
SizedBox(height: 20.h),
Text(
AppLocalizations.of(context)!.noStoriesInCategory(
capitalizeFirstLetter(categoryName),
),
textAlign: TextAlign.center,
),
),
],
],
),
),
),
),
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this package

animated_bottom_navigation_bar: ^1.4.0
animated_splash_screen: ^1.3.0
app_links: ^6.4.1
Expand Down