From 83be22687065a587bc4d92e08d5351954b207ae2 Mon Sep 17 00:00:00 2001 From: ashwanisng Date: Fri, 4 Jun 2021 11:15:48 +0530 Subject: [PATCH] managed all file and folder --- lib/main.dart | 56 ------------------ .../{homepage.dart => data_feild.dart} | 0 lib/widget/homepage.dart | 57 +++++++++++++++++++ test/widget_test.dart | 2 +- 4 files changed, 58 insertions(+), 57 deletions(-) rename lib/screens/{homepage.dart => data_feild.dart} (100%) create mode 100644 lib/widget/homepage.dart diff --git a/lib/main.dart b/lib/main.dart index 356f72e..33506a0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:vaccine_finder/screens/homepage.dart'; import 'package:vaccine_finder/screens/splash_screen.dart'; -import 'package:vaccine_finder/theme/style.dart'; -import 'package:vaccine_finder/theme/theme_provider.dart'; void main() { runApp(MyApp()); @@ -17,55 +13,3 @@ class MyApp extends StatelessWidget { ); } } - -class HomePage extends StatefulWidget { - @override - _HomePageState createState() => _HomePageState(); -} - -class _HomePageState extends State { - bool switchValue = false; - ThemeProvider themeProvider = ThemeProvider(); - - void getCurrentTheme() async { - themeProvider.darkTheme = await themeProvider.themePrefrences.getTheme(); - } - - @override - void initState() { - getCurrentTheme(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return ChangeNotifierProvider( - create: (_) => themeProvider, - child: Consumer( - builder: (context, value, child) { - return MaterialApp( - debugShowCheckedModeBanner: false, - theme: Style.themeData(themeProvider.darkTheme), - home: Scaffold( - appBar: AppBar( - backgroundColor: Color(0xff676FFE), - title: Text('Where is my Vaccine'), - actions: [ - Switch( - value: switchValue, - onChanged: (val) { - themeProvider.darkTheme = !themeProvider.darkTheme; - setState(() { - switchValue = val; - }); - }) - ], - ), - body: DataFeild(), - ), - ); - }, - ), - ); - } -} diff --git a/lib/screens/homepage.dart b/lib/screens/data_feild.dart similarity index 100% rename from lib/screens/homepage.dart rename to lib/screens/data_feild.dart diff --git a/lib/widget/homepage.dart b/lib/widget/homepage.dart new file mode 100644 index 0000000..fc4e2cc --- /dev/null +++ b/lib/widget/homepage.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:vaccine_finder/screens/data_feild.dart'; +import 'package:vaccine_finder/theme/style.dart'; +import 'package:vaccine_finder/theme/theme_provider.dart'; + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + bool switchValue = false; + ThemeProvider themeProvider = ThemeProvider(); + + void getCurrentTheme() async { + themeProvider.darkTheme = await themeProvider.themePrefrences.getTheme(); + } + + @override + void initState() { + getCurrentTheme(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return ChangeNotifierProvider( + create: (_) => themeProvider, + child: Consumer( + builder: (context, value, child) { + return MaterialApp( + debugShowCheckedModeBanner: false, + theme: Style.themeData(themeProvider.darkTheme), + home: Scaffold( + appBar: AppBar( + backgroundColor: Color(0xff676FFE), + title: Text('Where is my Vaccine'), + actions: [ + Switch( + value: switchValue, + onChanged: (val) { + themeProvider.darkTheme = !themeProvider.darkTheme; + setState(() { + switchValue = val; + }); + }) + ], + ), + body: DataFeild(), + ), + ); + }, + ), + ); + } +} diff --git a/test/widget_test.dart b/test/widget_test.dart index 516258d..6baaea7 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:vaccine_finder/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(HomePage()); + await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget);