Skip to content

Commit

Permalink
Merge pull request #65 from Hossam-Sayed/develop
Browse files Browse the repository at this point in the history
Fix AppCubit functionality, update Flutter version
  • Loading branch information
Hossam-Sayed authored Jun 17, 2024
2 parents d592bc6 + 4c1e614 commit cc226ab
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 238 deletions.
21 changes: 6 additions & 15 deletions lib/layout/home_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ import 'package:home/shared/components/components.dart';
import 'package:home/shared/cubit/cubit.dart';
import 'package:home/shared/cubit/states.dart';

class HomeLayout extends StatefulWidget {
const HomeLayout({super.key});
class HomeLayout extends StatelessWidget {
HomeLayout({super.key});

@override
State<HomeLayout> createState() => _HomeLayoutState();
static int choiceIndex = 2;
}

class _HomeLayoutState extends State<HomeLayout> {
var scaffoldKey = GlobalKey<ScaffoldState>();
var formKey = GlobalKey<FormState>();
var titleController = TextEditingController();
var timeController = TextEditingController();
var dateController = TextEditingController();
final formKey = GlobalKey<FormState>();
final titleController = TextEditingController();
final timeController = TextEditingController();
final dateController = TextEditingController();

@override
Widget build(BuildContext context) {
Expand All @@ -30,7 +23,6 @@ class _HomeLayoutState extends State<HomeLayout> {
builder: (BuildContext context, AppStates state) {
AppCubit cubit = AppCubit.get(context);
return Scaffold(
key: scaffoldKey,
appBar: AppBar(
elevation: 0.0,
actions: [
Expand Down Expand Up @@ -153,7 +145,6 @@ class _HomeLayoutState extends State<HomeLayout> {
onFabPress(
formKey: formKey,
context: context,
scaffoldKey: scaffoldKey,
titleController: titleController,
timeController: timeController,
dateController: dateController,
Expand Down
50 changes: 20 additions & 30 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:home/shared/components/constants.dart';
import 'package:home/shared/cubit/cubit.dart';
Expand All @@ -10,9 +9,6 @@ import 'layout/home_layout.dart';
void main() async {
Bloc.observer = MyBlocObserver();
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
await CacheHelper.init();
bool? isLight = CacheHelper.getModeData(key: 'isLight');
runApp(MyApp(isLight));
Expand All @@ -35,12 +31,12 @@ class MyApp extends StatelessWidget {
var cubit = AppCubit.get(context);
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const HomeLayout(),
home: HomeLayout(),
themeMode: cubit.isLight ? ThemeMode.light : ThemeMode.dark,
theme: ThemeData(
colorScheme: const ColorScheme.light(
primary: brightColor,
background: brightColor,
surface: brightColor,
secondary: darkColor,
error: Colors.red,
),
Expand Down Expand Up @@ -76,41 +72,37 @@ class MyApp extends StatelessWidget {
),
fontFamily: 'Nunito',
datePickerTheme: const DatePickerThemeData(
todayForegroundColor: MaterialStatePropertyAll(darkColor),
todayForegroundColor: WidgetStatePropertyAll(darkColor),
cancelButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(Colors.red),
overlayColor: MaterialStatePropertyAll(Color(0x11ff0000)),
foregroundColor: WidgetStatePropertyAll(Colors.red),
overlayColor: WidgetStatePropertyAll(Color(0x11ff0000)),
),
confirmButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(darkColor),
overlayColor: MaterialStatePropertyAll(Color(0x11000000)),
foregroundColor: WidgetStatePropertyAll(darkColor),
overlayColor: WidgetStatePropertyAll(Color(0x11000000)),
),
),
timePickerTheme: const TimePickerThemeData(
dayPeriodColor: Colors.grey,
dialHandColor: darkColor,
hourMinuteTextColor: darkColor,
cancelButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(Colors.red),
overlayColor: MaterialStatePropertyAll(Color(0x11ff0000)),
foregroundColor: WidgetStatePropertyAll(Colors.red),
overlayColor: WidgetStatePropertyAll(Color(0x11ff0000)),
),
confirmButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(darkColor),
overlayColor: MaterialStatePropertyAll(Color(0x11000000)),
foregroundColor: WidgetStatePropertyAll(darkColor),
overlayColor: WidgetStatePropertyAll(Color(0x11000000)),
),
),
),
darkTheme: ThemeData(
colorScheme: const ColorScheme.dark(
primary: darkColor,
background: darkColor,
secondary: brightColor,
// secondary: Color(0x33FFFFFF),
// secondary: Color(0xff1f1d2b),
error: Colors.red,
),
iconTheme: const IconThemeData(color: brightColor),
appBarTheme: const AppBarTheme(backgroundColor: darkColor),
floatingActionButtonTheme: const FloatingActionButtonThemeData(
foregroundColor: darkColor,
backgroundColor: brightColor,
Expand All @@ -122,11 +114,9 @@ class MyApp extends StatelessWidget {
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedIconTheme: IconThemeData(color: brightColor),
unselectedItemColor: Color(0xFF696c73),
// backgroundColor: darkColor,
type: BottomNavigationBarType.fixed,
showUnselectedLabels: false,
elevation: 5.0,
selectedItemColor: brightColor,
selectedLabelStyle: TextStyle(fontWeight: FontWeight.bold),
),
chipTheme: const ChipThemeData(
Expand All @@ -142,27 +132,27 @@ class MyApp extends StatelessWidget {
),
fontFamily: 'Nunito',
datePickerTheme: const DatePickerThemeData(
todayForegroundColor: MaterialStatePropertyAll(brightColor),
todayForegroundColor: WidgetStatePropertyAll(brightColor),
cancelButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(Colors.red),
overlayColor: MaterialStatePropertyAll(Color(0x11ff0000)),
foregroundColor: WidgetStatePropertyAll(Colors.red),
overlayColor: WidgetStatePropertyAll(Color(0x11ff0000)),
),
confirmButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(brightColor),
overlayColor: MaterialStatePropertyAll(Color(0x11FFFFFF)),
foregroundColor: WidgetStatePropertyAll(brightColor),
overlayColor: WidgetStatePropertyAll(Color(0x11FFFFFF)),
),
),
timePickerTheme: const TimePickerThemeData(
dayPeriodColor: Colors.grey,
dialHandColor: brightColor,
hourMinuteTextColor: brightColor,
cancelButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(Colors.red),
overlayColor: MaterialStatePropertyAll(Color(0x11ff0000)),
foregroundColor: WidgetStatePropertyAll(Colors.red),
overlayColor: WidgetStatePropertyAll(Color(0x11ff0000)),
),
confirmButtonStyle: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(brightColor),
overlayColor: MaterialStatePropertyAll(Color(0x11000000)),
foregroundColor: WidgetStatePropertyAll(brightColor),
overlayColor: WidgetStatePropertyAll(Color(0x11000000)),
),
),
),
Expand Down
1 change: 0 additions & 1 deletion lib/modules/active_tasks/active_tasks_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:home/shared/components/components.dart';
import 'package:home/shared/cubit/cubit.dart';
import 'package:home/shared/cubit/states.dart';


class ActiveTasksScreen extends StatelessWidget {
const ActiveTasksScreen({Key? key}) : super(key: key);

Expand Down
1 change: 0 additions & 1 deletion lib/modules/done_tasks/done_tasks_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:home/shared/components/components.dart';
import 'package:home/shared/cubit/cubit.dart';
import 'package:home/shared/cubit/states.dart';


class DoneTasksScreen extends StatelessWidget {
const DoneTasksScreen({Key? key}) : super(key: key);

Expand Down
Loading

0 comments on commit cc226ab

Please sign in to comment.