Skip to content

Commit

Permalink
Merge pull request #9 from mirmoktadir/testing
Browse files Browse the repository at this point in the history
upgrade appbar
  • Loading branch information
mirmoktadir committed Nov 28, 2023
2 parents 621344a + cf47664 commit 3e209be
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 52 deletions.
40 changes: 40 additions & 0 deletions lib/app/components/global-widgets/main_appbar.dart
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 1 addition & 1 deletion lib/app/components/navbar/bottom_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BottomNavbar extends GetView<NavbarController> {
BoxShadow(
color: theme.colorScheme.secondary.withOpacity(1),
spreadRadius: 0,
blurRadius: 20.r),
blurRadius: 10.r),
],
),
margin: EdgeInsets.symmetric(horizontal: 65.w),
Expand Down
44 changes: 16 additions & 28 deletions lib/app/modules/example/home-with-graphql/views/graphql_view.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -17,24 +17,9 @@ class GraphQLView extends GetView<GraphQLController> {
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())
Expand All @@ -58,14 +43,17 @@ class GraphQLView extends GetView<GraphQLController> {
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),
Expand Down Expand Up @@ -116,7 +104,7 @@ class GraphQLView extends GetView<GraphQLController> {
),
SizedBox(
height: controller.mutationResult.isEmpty
? 100.h
? 60.h
: 50.h),
Text(
"Query result",
Expand Down
26 changes: 5 additions & 21 deletions lib/app/modules/example/home-with-restAPI/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -19,27 +19,11 @@ class HomeView extends GetView<HomeController> {
@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
Expand Down
4 changes: 2 additions & 2 deletions lib/config/theme/dark_theme_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3e209be

Please sign in to comment.