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-08-30 21:37:24 +00:00
|
|
|
import 'drawer/drawer_page.dart';
|
2022-09-02 16:42:38 +00:00
|
|
|
import 'login/login_context.dart';
|
2021-12-10 23:01:44 +00:00
|
|
|
|
2022-08-27 17:33:28 +00:00
|
|
|
class AppScrollBehavior extends MaterialScrollBehavior {
|
|
|
|
@override
|
|
|
|
Set<PointerDeviceKind> get dragDevices => {
|
|
|
|
PointerDeviceKind.touch,
|
|
|
|
PointerDeviceKind.mouse,
|
2022-10-15 18:28:31 +00:00
|
|
|
PointerDeviceKind.trackpad
|
2022-08-27 17:33:28 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
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(
|
2022-11-01 23:36:21 +00:00
|
|
|
theme: ThemeData(
|
|
|
|
appBarTheme: AppBarTheme(backgroundColor: Color(0xff0d0d0d))),
|
2022-08-27 17:33:28 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|