-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-app.dart
58 lines (51 loc) · 1.5 KB
/
simple-app.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, annotate_overrides
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(home: ExampleApp()));
}
class ExampleApp extends StatefulWidget {
@override
State<ExampleApp> createState() => _ExampleAppState();
}
class _ExampleAppState extends State<ExampleApp> {
String currentPage = "Home";
Widget build(BuildContext context) {
Widget appBody = Center(child: Text("Hello World!", textScaleFactor: 3));
if (currentPage == "Horse"){
appBody = Image.network("https://mitch.website/horse.jpg");
}
Widget app = Scaffold(
body: appBody,
appBar: AppBar(title: Text("This is my app :3")),
drawer: Drawer(
child: ListView(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
child: Text("Menu", textScaleFactor: 2),
),
ListTile(
title: Text("Home"),
onTap: (){
setState((){
currentPage = "Home";
});
Navigator.pop(context);
}
),
ListTile(
title: Text("Horse"),
onTap: (){
setState((){
currentPage = "Horse";
});
Navigator.pop(context);
}
)
]
)
)
);
return app;
}
}