import 'package:flutter/material.dart'; import 'constants.dart'; void main() { String initialRoute; initialRoute = '/home'; final MyApp myApp = MyApp( initialRoute: initialRoute, //context: localContext, ); runApp(myApp); } class MyApp extends StatefulWidget { final String initialRoute; //final Context context; MyApp({this.initialRoute}); // This widget is the root of your application. @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'MyHomie App Demo', initialRoute: widget.initialRoute, supportedLocales: [ const Locale('en', 'US'), const Locale('fr', 'FR'), ], theme: ThemeData( primarySwatch: Colors.blue, scaffoldBackgroundColor: kBackgroundColor, //fontFamily: "Vollkorn", textTheme: TextTheme(bodyText1: TextStyle(color: kBodyTextColor)), visualDensity: VisualDensity.adaptivePlatformDensity, ), routes: { '/home': (context) => MyHomePage(title: 'MyHomie App Demo Home Page') } ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'You have pushed the button this many times:', ), Text( '$_counter', style: Theme.of(context).textTheme.headline4, ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: Icon(Icons.add), ), ); } }