2022-08-27 17:33:28 +00:00
|
|
|
import 'dart:ui';
|
|
|
|
|
2021-12-10 10:40:20 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-12-11 16:17:38 +00:00
|
|
|
import 'package:openmediacentermobile/log/log.dart';
|
2021-12-10 23:01:44 +00:00
|
|
|
import 'package:openmediacentermobile/login/login_screen.dart';
|
2021-12-10 10:40:20 +00:00
|
|
|
|
2022-04-15 19:57:15 +00:00
|
|
|
import 'DrawerPage.dart';
|
2021-12-10 23:01:44 +00:00
|
|
|
import 'login/logincontext.dart';
|
|
|
|
|
2022-08-27 17:33:28 +00:00
|
|
|
class AppScrollBehavior extends MaterialScrollBehavior {
|
|
|
|
@override
|
|
|
|
Set<PointerDeviceKind> get dragDevices => {
|
|
|
|
PointerDeviceKind.touch,
|
|
|
|
PointerDeviceKind.mouse,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-12-10 23:01:44 +00:00
|
|
|
class App extends StatelessWidget {
|
2021-12-10 17:36:59 +00:00
|
|
|
const App({Key? key}) : super(key: key);
|
2021-12-10 10:40:20 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-08-25 17:48:09 +00:00
|
|
|
var loginCtx = LoginContext.of(context);
|
2021-12-10 17:36:59 +00:00
|
|
|
|
2022-08-25 17:48:09 +00:00
|
|
|
Log.d("We are logged in: ${loginCtx.loggedIn}");
|
2021-12-10 17:36:59 +00:00
|
|
|
|
2022-08-25 17:48:09 +00:00
|
|
|
if (!loginCtx.loggedIn) {
|
2021-12-11 16:17:38 +00:00
|
|
|
return const MaterialApp(home: LoginScreen());
|
2021-12-10 10:40:20 +00:00
|
|
|
} else {
|
2022-08-27 17:33:28 +00:00
|
|
|
return MaterialApp(
|
|
|
|
scrollBehavior: AppScrollBehavior(),
|
2022-04-15 19:57:15 +00:00
|
|
|
home: DrawerPage(
|
2022-08-27 17:33:28 +00:00
|
|
|
title: 'OpenMediaCenter',
|
|
|
|
));
|
2021-12-10 10:40:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|