Add table creation
This commit is contained in:
parent
09c9549004
commit
4a5039cb19
19 changed files with 1132 additions and 141 deletions
|
|
@ -10,7 +10,18 @@ import 'package:tuuli_app/pages/not_found_page.dart';
|
|||
void main() async {
|
||||
await GetStorage.init();
|
||||
|
||||
Get.put(ApiClient.fromString("http://127.0.0.1:8000"), permanent: true);
|
||||
Get.put(
|
||||
ApiClient.fromString("http://127.0.0.1:8000"),
|
||||
permanent: true,
|
||||
builder: () {
|
||||
final client = ApiClient.fromString("http://127.0.0.1:8000");
|
||||
final accessToken = GetStorage().read<String>("accessToken");
|
||||
if (accessToken != null) {
|
||||
client.setAccessToken(accessToken);
|
||||
}
|
||||
return client;
|
||||
},
|
||||
);
|
||||
|
||||
runApp(const MainApp());
|
||||
}
|
||||
|
|
@ -33,15 +44,12 @@ class MainApp extends StatelessWidget {
|
|||
}
|
||||
|
||||
Route _onGenerateRoute(RouteSettings settings) {
|
||||
Widget? pageBody;
|
||||
bool appBarNeeded = true;
|
||||
Widget pageBody;
|
||||
switch (settings.name) {
|
||||
case "/":
|
||||
appBarNeeded = false;
|
||||
pageBody = const CheckupPage();
|
||||
break;
|
||||
case "/login":
|
||||
appBarNeeded = false;
|
||||
pageBody = const LoginPage();
|
||||
break;
|
||||
case "/home":
|
||||
|
|
@ -53,38 +61,7 @@ class MainApp extends StatelessWidget {
|
|||
}
|
||||
|
||||
return MaterialPageRoute(
|
||||
builder: (context) => Scaffold(
|
||||
appBar: appBarNeeded
|
||||
? AppBar(
|
||||
title: const Text('GWS Playground'),
|
||||
actions: [
|
||||
if (Navigator.of(context).canPop())
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Get.back(canPop: false);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.home),
|
||||
onPressed: () {
|
||||
Get.offAllNamed("/");
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.logout),
|
||||
onPressed: () {
|
||||
GetStorage().erase().then((value) {
|
||||
GetStorage().save();
|
||||
Get.offAllNamed("/");
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
body: pageBody,
|
||||
),
|
||||
builder: (context) => pageBody,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue