Windows App Can’t close when in Mobile Mode

This commit is contained in:
Hillel Coren 2022-10-11 09:04:26 +03:00
parent 39e8279943
commit 04476b8d55
2 changed files with 358 additions and 341 deletions

View File

@ -11,6 +11,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:intl/intl.dart';
import 'package:invoiceninja_flutter/ui/app/window_manager.dart';
import 'package:invoiceninja_flutter/ui/bank_account/edit/bank_account_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/settings/payment_settings_vm.dart';
import 'package:local_auth/local_auth.dart';
@ -333,6 +334,7 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
),
child: WebSocketRefresh(
companyId: state.company?.id,
child: WindowManager(
child: MaterialApp(
builder: (BuildContext context, Widget child) {
final MediaQueryData data = MediaQuery.of(context);
@ -340,7 +342,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
data: data.copyWith(
textScaleFactor: state.prefState.textScaleFactor,
alwaysUse24HourFormat:
state.company?.settings?.enableMilitaryTime ?? false,
state.company?.settings?.enableMilitaryTime ??
false,
),
child: child,
);
@ -350,8 +353,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
: null,
navigatorKey: navigatorKey,
supportedLocales: kLanguages
.map(
(String locale) => AppLocalization.createLocale(locale))
.map((String locale) =>
AppLocalization.createLocale(locale))
.toList(),
debugShowCheckedModeBanner: false,
//showPerformanceOverlay: true,
@ -390,8 +393,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
primaryColorDark: Colors.black,
textButtonTheme:
TextButtonThemeData(style: textButtonTheme),
outlinedButtonTheme:
OutlinedButtonThemeData(style: outlinedButtonTheme),
outlinedButtonTheme: OutlinedButtonThemeData(
style: outlinedButtonTheme),
)
: ThemeData(
colorScheme: ColorScheme.fromSwatch().copyWith(
@ -431,17 +434,19 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
appBarTheme: AppBarTheme(
color: hasAccentColor ? accentColor : Colors.white,
iconTheme: IconThemeData(
color: hasAccentColor ? Colors.white : accentColor,
color:
hasAccentColor ? Colors.white : accentColor,
),
titleTextStyle: TextStyle(
fontSize: 20,
color:
hasAccentColor ? Colors.white : Colors.black),
color: hasAccentColor
? Colors.white
: Colors.black),
),
textButtonTheme:
TextButtonThemeData(style: textButtonTheme),
outlinedButtonTheme:
OutlinedButtonThemeData(style: outlinedButtonTheme),
outlinedButtonTheme: OutlinedButtonThemeData(
style: outlinedButtonTheme),
),
title: kAppName,
onGenerateRoute: isMobile(context) ? null : generateRoute,
@ -461,9 +466,12 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
ProductViewScreen(),
ProductEditScreen.route: (context) =>
ProductEditScreen(),
ClientScreen.route: (context) => ClientScreenBuilder(),
ClientViewScreen.route: (context) => ClientViewScreen(),
ClientEditScreen.route: (context) => ClientEditScreen(),
ClientScreen.route: (context) =>
ClientScreenBuilder(),
ClientViewScreen.route: (context) =>
ClientViewScreen(),
ClientEditScreen.route: (context) =>
ClientEditScreen(),
ClientPdfScreen.route: (context) => ClientPdfScreen(),
InvoiceScreen.route: (context) =>
InvoiceScreenBuilder(),
@ -473,7 +481,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
InvoiceEditScreen(),
InvoiceEmailScreen.route: (context) =>
InvoiceEmailScreen(),
InvoicePdfScreen.route: (context) => InvoicePdfScreen(),
InvoicePdfScreen.route: (context) =>
InvoicePdfScreen(),
DocumentScreen.route: (context) =>
DocumentScreenBuilder(),
DocumentViewScreen.route: (context) =>
@ -486,9 +495,12 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
ExpenseViewScreen(),
ExpenseEditScreen.route: (context) =>
ExpenseEditScreen(),
VendorScreen.route: (context) => VendorScreenBuilder(),
VendorViewScreen.route: (context) => VendorViewScreen(),
VendorEditScreen.route: (context) => VendorEditScreen(),
VendorScreen.route: (context) =>
VendorScreenBuilder(),
VendorViewScreen.route: (context) =>
VendorViewScreen(),
VendorEditScreen.route: (context) =>
VendorEditScreen(),
TaskScreen.route: (context) => TaskScreenBuilder(),
TaskViewScreen.route: (context) => TaskViewScreen(),
TaskEditScreen.route: (context) => TaskEditScreen(),
@ -509,7 +521,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
QuoteScreen.route: (context) => QuoteScreenBuilder(),
QuoteViewScreen.route: (context) => QuoteViewScreen(),
QuoteEditScreen.route: (context) => QuoteEditScreen(),
QuoteEmailScreen.route: (context) => QuoteEmailScreen(),
QuoteEmailScreen.route: (context) =>
QuoteEmailScreen(),
QuotePdfScreen.route: (context) => QuotePdfScreen(),
// STARTER: routes - do not remove comment
TransactionScreen.route: (context) =>
@ -577,12 +590,18 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
PaymentTermEditScreen(),
PaymentTermViewScreen.route: (context) =>
PaymentTermViewScreen(),
DesignScreen.route: (context) => DesignScreenBuilder(),
DesignViewScreen.route: (context) => DesignViewScreen(),
DesignEditScreen.route: (context) => DesignEditScreen(),
CreditScreen.route: (context) => CreditScreenBuilder(),
CreditViewScreen.route: (context) => CreditViewScreen(),
CreditEditScreen.route: (context) => CreditEditScreen(),
DesignScreen.route: (context) =>
DesignScreenBuilder(),
DesignViewScreen.route: (context) =>
DesignViewScreen(),
DesignEditScreen.route: (context) =>
DesignEditScreen(),
CreditScreen.route: (context) =>
CreditScreenBuilder(),
CreditViewScreen.route: (context) =>
CreditViewScreen(),
CreditEditScreen.route: (context) =>
CreditEditScreen(),
CreditEmailScreen.route: (context) =>
CreditEmailScreen(),
CreditPdfScreen.route: (context) => CreditPdfScreen(),
@ -653,6 +672,7 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
: {},
),
),
),
);
}),
),

View File

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/ui/app/app_title_bar.dart';
import 'package:invoiceninja_flutter/ui/app/window_manager.dart';
import 'package:invoiceninja_flutter/ui/bank_account/bank_account_screen_vm.dart';
import 'package:invoiceninja_flutter/ui/bank_account/edit/bank_account_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/bank_account/view/bank_account_view_vm.dart';
@ -318,7 +317,6 @@ class MainScreen extends StatelessWidget {
return false;
},
child: WindowManager(
child: DesktopSessionTimeout(
child: SafeArea(
child: FocusTraversalGroup(
@ -346,7 +344,6 @@ class MainScreen extends StatelessWidget {
),
),
),
),
);
});
}