Merge remote-tracking branch 'origin/feature/namespace' into main
This commit is contained in:
123
lib/main.dart
123
lib/main.dart
@@ -9,6 +9,7 @@ import 'package:oc_front/core/sections/header/header.dart';
|
||||
import 'package:oc_front/core/sections/header/menu.dart';
|
||||
import 'package:oc_front/core/sections/left_menu.dart';
|
||||
import 'package:oc_front/core/services/auth.service.dart';
|
||||
import 'package:oc_front/core/services/enum_service.dart';
|
||||
import 'package:oc_front/core/services/router.dart';
|
||||
import 'package:oc_front/core/sections/end_drawer.dart';
|
||||
import 'package:oc_front/widgets/dialog/login.dart';
|
||||
@@ -35,7 +36,9 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AuthService.init();
|
||||
return MaterialApp.router(routerConfig: GoRouter(routes: AppRouter.routes));
|
||||
EnumService.init();
|
||||
SearchConstants.clear();
|
||||
return MaterialApp.router( routerConfig: GoRouter( routes: AppRouter.routes ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +86,7 @@ double getMainHeight(BuildContext context) {
|
||||
double getMainWidth(BuildContext context) {
|
||||
return getWidth(context) - 50;
|
||||
}
|
||||
|
||||
bool loginIsSet = false;
|
||||
class MainPageState extends State<MainPage> {
|
||||
bool isCtrl = false;
|
||||
final FocusNode node = FocusNode();
|
||||
@@ -103,15 +106,14 @@ class MainPageState extends State<MainPage> {
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.i
|
||||
scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
isCtrl = false;
|
||||
if (!AuthService.isConnected()) {
|
||||
print("isConnected: ${AuthService.isConnected()}");
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
isCtrl = false;
|
||||
if (!AuthService.isConnected() && !loginIsSet) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
loginIsSet = true;
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context ?? context, builder: (context) {
|
||||
return AlertDialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -120,63 +122,46 @@ class MainPageState extends State<MainPage> {
|
||||
});
|
||||
});
|
||||
}
|
||||
return FutureBuilder(
|
||||
future: AuthService.init(),
|
||||
builder: (e, s) {
|
||||
WorkspaceLocal.init(context, false);
|
||||
CollaborativeAreaLocal.init(context, false);
|
||||
|
||||
HeaderConstants.height =
|
||||
HeaderConstants.isNoHeader(AppRouter.currentRoute.route) ||
|
||||
AppRouter.currentRoute.factory.searchFill()
|
||||
? 50
|
||||
: 100;
|
||||
return Scaffold(
|
||||
key: scaffoldKey,
|
||||
endDrawer: EndDrawerWidget(),
|
||||
body: SingleChildScrollView(
|
||||
controller: ScrollController(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
HeaderMenuWidget(),
|
||||
Row(children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
decoration: BoxDecoration(color: darkColor),
|
||||
width: 50,
|
||||
height: getHeight(context) - 50,
|
||||
child:
|
||||
SingleChildScrollView(child: LeftMenuWidget())),
|
||||
SizedBox(
|
||||
width: getMainWidth(context),
|
||||
height: getHeight(context) - 50,
|
||||
child: KeyboardListener(
|
||||
focusNode: node,
|
||||
onKeyEvent: (event) async {
|
||||
if (event.logicalKey ==
|
||||
LogicalKeyboardKey.controlLeft) {
|
||||
isCtrl = (event is KeyDownEvent);
|
||||
node.requestFocus();
|
||||
} else if ((event is KeyDownEvent) &&
|
||||
event.logicalKey ==
|
||||
LogicalKeyboardKey.enter) {
|
||||
AppRouter.currentRoute.factory
|
||||
.search(context, isCtrl);
|
||||
node.requestFocus();
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
HeaderWidget(),
|
||||
widget.page ??
|
||||
Container() // CatalogPageWidget(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
])
|
||||
]))));
|
||||
});
|
||||
return FutureBuilder(future: AuthService.init(),
|
||||
builder: (e, s) {
|
||||
WorkspaceLocal.init(context, false);
|
||||
HeaderConstants.height = HeaderConstants.isNoHeader(AppRouter.currentRoute.route) || AppRouter.currentRoute.factory.searchFill() ? 50 : 100;
|
||||
return Scaffold( key: scaffoldKey, endDrawer: EndDrawerWidget(), body:
|
||||
SingleChildScrollView(
|
||||
controller: ScrollController(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SingleChildScrollView(
|
||||
child: Column( children: [
|
||||
HeaderMenuWidget(),
|
||||
Row( children : [
|
||||
Container( padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
decoration: BoxDecoration( color: darkColor),
|
||||
width: 50, height: getHeight(context) - 50,
|
||||
child: SingleChildScrollView( child: LeftMenuWidget() )),
|
||||
SizedBox( width: getMainWidth(context), height: getHeight(context) - 50,
|
||||
child: KeyboardListener(
|
||||
focusNode: node,
|
||||
onKeyEvent: (event) async {
|
||||
if ( event.logicalKey == LogicalKeyboardKey.controlLeft ) {
|
||||
isCtrl = (event is KeyDownEvent);
|
||||
node.requestFocus();
|
||||
} else if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
AppRouter.currentRoute.factory.search(context, isCtrl);
|
||||
node.requestFocus();
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
HeaderWidget(),
|
||||
widget.page ?? Container() // CatalogPageWidget(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
])
|
||||
])
|
||||
)
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user