diff --git a/lib/app/components/global-widgets/main_appbar.dart b/lib/app/components/global-widgets/main_appbar.dart new file mode 100644 index 0000000..420267a --- /dev/null +++ b/lib/app/components/global-widgets/main_appbar.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:iconly/iconly.dart'; +import 'package:iconsax/iconsax.dart'; + +class MainAppBar extends StatelessWidget implements PreferredSizeWidget { + const MainAppBar({ + super.key, + required this.prefixAction, + required this.suffixAction, + }); + final VoidCallback prefixAction; + final VoidCallback suffixAction; + @override + Widget build(BuildContext context) { + return AppBar( + title: const Text('GetX Standard'), + leading: IconButton( + onPressed: prefixAction, + icon: Icon( + Get.isDarkMode ? Iconsax.moon5 : Iconsax.moon5, + color: Get.isDarkMode ? Colors.white : Colors.black, + ), + ), + actions: [ + IconButton( + onPressed: suffixAction, + icon: const Icon( + IconlyBold.graph, + color: Colors.white, + ), + ), + ], + centerTitle: true, + ); + } + + @override + Size get preferredSize => const Size.fromHeight(kToolbarHeight); +} diff --git a/lib/app/components/navbar/bottom_navbar.dart b/lib/app/components/navbar/bottom_navbar.dart index 4dce06e..2d9e420 100755 --- a/lib/app/components/navbar/bottom_navbar.dart +++ b/lib/app/components/navbar/bottom_navbar.dart @@ -34,7 +34,7 @@ class BottomNavbar extends GetView { BoxShadow( color: theme.colorScheme.secondary.withOpacity(1), spreadRadius: 0, - blurRadius: 20.r), + blurRadius: 10.r), ], ), margin: EdgeInsets.symmetric(horizontal: 65.w), diff --git a/lib/app/modules/example/home-with-graphql/views/graphql_view.dart b/lib/app/modules/example/home-with-graphql/views/graphql_view.dart index e0092a8..26f79d9 100755 --- a/lib/app/modules/example/home-with-graphql/views/graphql_view.dart +++ b/lib/app/modules/example/home-with-graphql/views/graphql_view.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:getx_standard/app/components/global-widgets/main_appbar.dart'; import 'package:getx_standard/app/components/global-widgets/my_buttons.dart'; -import 'package:iconly/iconly.dart'; import 'package:iconsax/iconsax.dart'; import '../../../../../config/theme/my_theme.dart'; @@ -17,24 +17,9 @@ class GraphQLView extends GetView { var theme = Theme.of(context); return Scaffold( - appBar: AppBar( - title: const Text('GetX Standard'), - leading: IconButton( - onPressed: () => MyTheme.changeTheme(), - icon: Icon( - Get.isDarkMode ? Iconsax.moon5 : Iconsax.sun5, - color: Colors.white, - ), - ), - actions: [ - IconButton( - onPressed: () => controller.navController.selectedIndex.value = 0, - icon: const Icon( - IconlyBold.home, - color: Colors.white, - )), - ], - centerTitle: true, + appBar: MainAppBar( + prefixAction: () => MyTheme.changeTheme(), + suffixAction: () => controller.navController.selectedIndex.value = 0, ), body: Obx(() => controller.isError.value == true ? EmptyWidget(onPressed: () async => await controller.getTodos()) @@ -58,14 +43,17 @@ class GraphQLView extends GetView { child: Column( children: [ controller.mutationResult.isEmpty - ? SizedBox( - width: 150.sp, - height: 48.sp, - child: PrimaryButton( - title: "Run mutation", - onPressed: () async => - await controller.updateTodo(), - inactive: false), + ? Padding( + padding: EdgeInsets.only(top: 30.sp), + child: SizedBox( + width: 150.sp, + height: 48.sp, + child: PrimaryButton( + title: "Run mutation", + onPressed: () async => + await controller.updateTodo(), + inactive: false), + ), ) : const SizedBox(), SizedBox(height: 10.h), @@ -116,7 +104,7 @@ class GraphQLView extends GetView { ), SizedBox( height: controller.mutationResult.isEmpty - ? 100.h + ? 60.h : 50.h), Text( "Query result", diff --git a/lib/app/modules/example/home-with-restAPI/views/home_view.dart b/lib/app/modules/example/home-with-restAPI/views/home_view.dart index b55bfab..38b4313 100755 --- a/lib/app/modules/example/home-with-restAPI/views/home_view.dart +++ b/lib/app/modules/example/home-with-restAPI/views/home_view.dart @@ -4,11 +4,11 @@ import 'package:get/get.dart'; import 'package:getx_standard/app/components/global-widgets/splash_container.dart'; import 'package:getx_standard/config/theme/dark_theme_colors.dart'; import 'package:getx_standard/config/theme/light_theme_colors.dart'; -import 'package:iconly/iconly.dart'; import 'package:iconsax/iconsax.dart'; import '../../../../../config/theme/my_theme.dart'; import '../../../../components/global-widgets/empty_widget.dart'; +import '../../../../components/global-widgets/main_appbar.dart'; import '../../../../components/global-widgets/network_image_box.dart'; import '../../../../data/local/my_shared_pref.dart'; import '../controllers/home_controller.dart'; @@ -19,27 +19,11 @@ class HomeView extends GetView { @override Widget build(BuildContext context) { var theme = Theme.of(context); - + // return Scaffold( - appBar: AppBar( - title: const Text('GetX Standard'), - leading: IconButton( - onPressed: () => MyTheme.changeTheme(), - icon: Icon( - Get.isDarkMode ? Iconsax.sun5 : Iconsax.moon5, - color: Colors.white, - ), - ), - actions: [ - IconButton( - onPressed: () => controller.navController.selectedIndex.value = 1, - icon: const Icon( - IconlyBold.graph, - color: Colors.white, - ), - ), - ], - centerTitle: true, + appBar: MainAppBar( + prefixAction: () => MyTheme.changeTheme(), + suffixAction: () => controller.navController.selectedIndex.value = 1, ), body: Obx( () => controller.isError.value == true diff --git a/lib/config/theme/dark_theme_colors.dart b/lib/config/theme/dark_theme_colors.dart index 7cb969b..2a2d8f8 100755 --- a/lib/config/theme/dark_theme_colors.dart +++ b/lib/config/theme/dark_theme_colors.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; class DarkThemeColors { //dark swatch - static const Color primaryColor = Colors.orange; - static Color accentColor = Colors.blueAccent; + static const Color primaryColor = Color(0xffed7014); + static const Color accentColor = Color(0xff8d4004); //Appbar static const Color appbarColor = Colors.black;