49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:logger/logger.dart';
|
|
import 'package:openmediacentermobile/login/login_screen.dart';
|
|
|
|
import 'login/logincontext.dart';
|
|
import 'video_feed.dart';
|
|
|
|
// class App extends StatefulWidget {
|
|
// const App({Key? key}) : super(key: key);
|
|
// @override
|
|
// State<StatefulWidget> createState() => AppState();
|
|
// }
|
|
|
|
class App extends StatelessWidget {
|
|
const App({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var loginctx = LoginContext.of(context);
|
|
|
|
Logger().d("We are logged in: ${loginctx.LoggedIn}");
|
|
|
|
if (!loginctx.LoggedIn) {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Login"),
|
|
),
|
|
body: LoginScreen()));
|
|
} else {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: Row(
|
|
children: [
|
|
Text("Openmediacenter"),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
loginctx.onLoggin(false);
|
|
},
|
|
child: Text("logout"))
|
|
],
|
|
),
|
|
),
|
|
body: VideoFeed()));
|
|
}
|
|
}
|
|
}
|