You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.2 KiB
Dart
105 lines
3.2 KiB
Dart
|
4 years ago
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
|
||
|
|
import 'core/base/app_scaffold_widget.dart';
|
||
|
|
import 'core/base/project_view_model.dart';
|
||
|
|
import 'core/config/size_config.dart';
|
||
|
|
|
||
|
|
void main() {
|
||
|
|
runApp(const MyApp());
|
||
|
|
}
|
||
|
|
|
||
|
|
class MyApp extends StatelessWidget {
|
||
|
|
const MyApp({Key key}) : super(key: key);
|
||
|
|
|
||
|
|
// This widget is the root of your application.
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return LayoutBuilder(
|
||
|
|
builder: (context, constraints) {
|
||
|
|
return OrientationBuilder(builder: (context, orientation) {
|
||
|
|
SizeConfig().init(constraints, orientation);
|
||
|
|
return MultiProvider(
|
||
|
|
providers: [
|
||
|
|
|
||
|
|
ChangeNotifierProvider<ProjectViewModel>(
|
||
|
|
create: (context) => ProjectViewModel(),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
child: Consumer<ProjectViewModel>(
|
||
|
|
builder: (context, projectProvider, child) => MaterialApp(
|
||
|
|
showSemanticsDebugger: false,
|
||
|
|
title: 'Doctors App',
|
||
|
|
theme: ThemeData(
|
||
|
|
primarySwatch: Colors.grey,
|
||
|
|
primaryColor: Colors.grey,
|
||
|
|
fontFamily: 'Poppins',
|
||
|
|
dividerColor: Colors.grey[350],
|
||
|
|
backgroundColor: Color.fromRGBO(255, 255, 255, 1),
|
||
|
|
),
|
||
|
|
home:MyHomePage() ,
|
||
|
|
debugShowCheckedModeBanner: false,
|
||
|
|
)),
|
||
|
|
);
|
||
|
|
});
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class MyHomePage extends StatefulWidget {
|
||
|
|
|
||
|
|
// This widget is the home page of your application. It is stateful, meaning
|
||
|
|
// that it has a State object (defined below) that contains fields that affect
|
||
|
|
// how it looks.
|
||
|
|
|
||
|
|
// This class is the configuration for the state. It holds the values (in this
|
||
|
|
// case the title) provided by the parent (in this case the App widget) and
|
||
|
|
// used by the build method of the State. Fields in a Widget subclass are
|
||
|
|
// always marked "final".
|
||
|
|
|
||
|
|
String title ="MyHomePage";
|
||
|
|
|
||
|
|
@override
|
||
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _MyHomePageState extends State<MyHomePage> {
|
||
|
|
int _counter = 0;
|
||
|
|
|
||
|
|
void _incrementCounter() {
|
||
|
|
setState(() {
|
||
|
|
// This call to setState tells the Flutter framework that something has
|
||
|
|
// changed in this State, which causes it to rerun the build method below
|
||
|
|
// so that the display can reflect the updated values. If we changed
|
||
|
|
// _counter without calling setState(), then the build method would not be
|
||
|
|
// called again, and so nothing would appear to happen.
|
||
|
|
_counter++;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return AppScaffold(
|
||
|
|
appBar: AppBar(
|
||
|
|
title: Text(widget.title),
|
||
|
|
),
|
||
|
|
body: Center(
|
||
|
|
|
||
|
|
child: Column(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
children: <Widget>[
|
||
|
|
const Text(
|
||
|
|
'You have pushed the button this many times:',
|
||
|
|
),
|
||
|
|
Text(
|
||
|
|
'$_counter',
|
||
|
|
style: Theme.of(context).textTheme.headline4,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
), // This trailing comma makes auto-formatting nicer for build methods.
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|