mirror of
https://bitbucket.org/myhomie/myhomie_app.git
synced 2025-12-06 00:51:19 +00:00
98 lines
2.2 KiB
Dart
98 lines
2.2 KiB
Dart
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<MyApp> {
|
|
@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<MyHomePage> {
|
|
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: <Widget>[
|
|
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),
|
|
),
|
|
);
|
|
}
|
|
} |