oclib
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:localstorage/localstorage.dart';
|
||||
import 'package:oc_front/core/models/shared_workspace_local.dart';
|
||||
import 'package:oc_front/core/models/workspace_local.dart';
|
||||
import 'package:oc_front/core/sections/header/header.dart';
|
||||
import 'package:oc_front/core/sections/header/menu.dart';
|
||||
@@ -14,7 +15,6 @@ 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';
|
||||
import 'package:oc_front/core/conf/conf_reader.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -35,6 +35,7 @@ class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppRouter.verifyRoute(context);
|
||||
AuthService.init();
|
||||
EnumService.init();
|
||||
SearchConstants.clear();
|
||||
@@ -88,7 +89,6 @@ double getMainWidth(BuildContext context) {
|
||||
}
|
||||
bool loginIsSet = false;
|
||||
class MainPageState extends State<MainPage> {
|
||||
bool isCtrl = false;
|
||||
final FocusNode node = FocusNode();
|
||||
@override
|
||||
void initState() {
|
||||
@@ -106,13 +106,13 @@ 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() && !loginIsSet) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
loginIsSet = true;
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context ?? context, builder: (context) {
|
||||
// ignore: use_build_context_synchronously
|
||||
context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -137,23 +137,20 @@ class MainPageState extends State<MainPage> {
|
||||
Container( padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
decoration: BoxDecoration( color: darkColor),
|
||||
width: 50, height: getHeight(context) - 50,
|
||||
child: SingleChildScrollView( child: LeftMenuWidget() )),
|
||||
child: const 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);
|
||||
if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
AppRouter.currentRoute.factory.search(context, false);
|
||||
node.requestFocus();
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
HeaderWidget(),
|
||||
const HeaderWidget(),
|
||||
widget.page ?? Container() // CatalogPageWidget(),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user