Skip to content

Commit

Permalink
Google fonts and themes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZainNaqvi committed Jul 29, 2022
1 parent f64bf33 commit 66f9d72
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
22 changes: 15 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example_todo_sqflite/services/theme_services.dart';
import 'package:example_todo_sqflite/themes.dart';
import 'package:example_todo_sqflite/ui/home_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:get_storage/get_storage.dart';

Expand All @@ -15,13 +16,20 @@ class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: Themes.light,
darkTheme: Themes.dark,
themeMode: ThemeServices().theme,
home: const HomePage(),
return ScreenUtilInit(
designSize: const Size(360, 690),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: Themes.light,
darkTheme: Themes.dark,
themeMode: ThemeServices().theme,
home: const HomePage(),
);
}
);
}
}
17 changes: 15 additions & 2 deletions lib/themes.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:example_todo_sqflite/ui/constants.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';

class Themes {
// light theme
static final light = ThemeData(
backgroundColor: Colors.white,
backgroundColor: white,
primaryColor: primaryClr,
brightness: Brightness.light,
);
Expand All @@ -21,7 +23,18 @@ class Themes {
TextStyle get subHeadingStyle {
return (GoogleFonts.lato(
textStyle: TextStyle(
fontSize: 24,
fontSize: 24.sp,
color: Get.isDarkMode ? Colors.grey[400] : Colors.grey,
fontWeight: FontWeight.bold,
),
));
}

TextStyle get headingStyle {
return (GoogleFonts.lato(
textStyle: TextStyle(
fontSize: 30.sp,
color: Get.isDarkMode ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
));
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
const Color bluishClr = Color(0xff4e5ae8);
const Color yellowClr = Color(0xffffb746);
const Color pickClr = Color(0xffff4667);
const Color white = Colors.white;
const Color white = Color(0xffF2F2F2);
const Color primaryClr = bluishClr;
const Color darkgreyClr = Color(0xff121212);
const Color darkHeaderClr = Color(0xff424242);
9 changes: 8 additions & 1 deletion lib/ui/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:example_todo_sqflite/services/theme_services.dart';
import 'package:example_todo_sqflite/themes.dart';
import 'package:example_todo_sqflite/ui/constants.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
Expand Down Expand Up @@ -48,7 +49,10 @@ class _HomePageState extends State<HomePage> {
),
style: subHeadingStyle,
),
Text("Today"),
Text(
"Today",
style: headingStyle,
),
],
),
),
Expand All @@ -62,6 +66,8 @@ class _HomePageState extends State<HomePage> {

AppBar _appBar() {
return AppBar(
elevation: 0,
backgroundColor: Get.isDarkMode ? darkgreyClr : Colors.white,
leading: IconButton(
onPressed: () {
ThemeServices().updateTheme();
Expand All @@ -76,6 +82,7 @@ class _HomePageState extends State<HomePage> {
},
icon: Icon(
Get.isDarkMode ? Icons.wb_sunny_rounded : Icons.nightlight_round,
color: Get.isDarkMode ? Colors.white : Colors.black,
),
),
actions: [
Expand Down

0 comments on commit 66f9d72

Please sign in to comment.