Correct scrolling in mobile apps
This commit is contained in:
parent
734b2033d1
commit
764d51d8b7
|
|
@ -136,6 +136,7 @@ void main({bool isTesting = false}) async {
|
||||||
|
|
||||||
doWhenWindowReady(() {
|
doWhenWindowReady(() {
|
||||||
final win = appWindow;
|
final win = appWindow;
|
||||||
|
win.title = 'Invoice Ninja';
|
||||||
//const initialSize = Size(600, 450);
|
//const initialSize = Size(600, 450);
|
||||||
//win.minSize = initialSize;
|
//win.minSize = initialSize;
|
||||||
//win.size = initialSize;
|
//win.size = initialSize;
|
||||||
|
|
|
||||||
|
|
@ -243,15 +243,6 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
state.prefState.enableDarkMode ? Colors.white : Colors.black87,
|
state.prefState.enableDarkMode ? Colors.white : Colors.black87,
|
||||||
);
|
);
|
||||||
|
|
||||||
// https://stackoverflow.com/a/69883043/497368
|
|
||||||
MediaQueryData windowData =
|
|
||||||
MediaQueryData.fromWindow(WidgetsBinding.instance.window);
|
|
||||||
windowData = windowData.copyWith(
|
|
||||||
textScaleFactor: state.prefState.textScaleFactor,
|
|
||||||
alwaysUse24HourFormat:
|
|
||||||
state.company?.settings?.enableMilitaryTime ?? false,
|
|
||||||
);
|
|
||||||
|
|
||||||
return StyledToast(
|
return StyledToast(
|
||||||
locale: locale,
|
locale: locale,
|
||||||
duration: Duration(seconds: 3),
|
duration: Duration(seconds: 3),
|
||||||
|
|
@ -264,15 +255,24 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
),
|
),
|
||||||
child: WebSocketRefresh(
|
child: WebSocketRefresh(
|
||||||
companyId: state.company?.id,
|
companyId: state.company?.id,
|
||||||
child: MediaQuery(
|
|
||||||
data: windowData,
|
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
builder: (BuildContext context, Widget child) {
|
||||||
|
final MediaQueryData data = MediaQuery.of(context);
|
||||||
|
return MediaQuery(
|
||||||
|
data: data.copyWith(
|
||||||
|
textScaleFactor: state.prefState.textScaleFactor,
|
||||||
|
alwaysUse24HourFormat:
|
||||||
|
state.company?.settings?.enableMilitaryTime ?? false,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
useInheritedMediaQuery: true,
|
useInheritedMediaQuery: true,
|
||||||
scrollBehavior: MyCustomScrollBehavior(),
|
scrollBehavior: MyCustomScrollBehavior(),
|
||||||
navigatorKey: navigatorKey,
|
navigatorKey: navigatorKey,
|
||||||
supportedLocales: kLanguages
|
supportedLocales: kLanguages
|
||||||
.map((String locale) =>
|
.map(
|
||||||
AppLocalization.createLocale(locale))
|
(String locale) => AppLocalization.createLocale(locale))
|
||||||
.toList(),
|
.toList(),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
//showPerformanceOverlay: true,
|
//showPerformanceOverlay: true,
|
||||||
|
|
@ -308,8 +308,8 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
primaryColorDark: Colors.black,
|
primaryColorDark: Colors.black,
|
||||||
textButtonTheme:
|
textButtonTheme:
|
||||||
TextButtonThemeData(style: textButtonTheme),
|
TextButtonThemeData(style: textButtonTheme),
|
||||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
outlinedButtonTheme:
|
||||||
style: outlinedButtonTheme),
|
OutlinedButtonThemeData(style: outlinedButtonTheme),
|
||||||
)
|
)
|
||||||
: ThemeData(
|
: ThemeData(
|
||||||
colorScheme: ColorScheme.fromSwatch()
|
colorScheme: ColorScheme.fromSwatch()
|
||||||
|
|
@ -345,19 +345,17 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
color: hasAccentColor ? accentColor : Colors.white,
|
color: hasAccentColor ? accentColor : Colors.white,
|
||||||
iconTheme: IconThemeData(
|
iconTheme: IconThemeData(
|
||||||
color:
|
color: hasAccentColor ? Colors.white : accentColor,
|
||||||
hasAccentColor ? Colors.white : accentColor,
|
|
||||||
),
|
),
|
||||||
titleTextStyle: TextStyle(
|
titleTextStyle: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: hasAccentColor
|
color:
|
||||||
? Colors.white
|
hasAccentColor ? Colors.white : Colors.black),
|
||||||
: Colors.black),
|
|
||||||
),
|
),
|
||||||
textButtonTheme:
|
textButtonTheme:
|
||||||
TextButtonThemeData(style: textButtonTheme),
|
TextButtonThemeData(style: textButtonTheme),
|
||||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
outlinedButtonTheme:
|
||||||
style: outlinedButtonTheme),
|
OutlinedButtonThemeData(style: outlinedButtonTheme),
|
||||||
),
|
),
|
||||||
title: kAppName,
|
title: kAppName,
|
||||||
onGenerateRoute: isMobile(context) ? null : generateRoute,
|
onGenerateRoute: isMobile(context) ? null : generateRoute,
|
||||||
|
|
@ -377,12 +375,9 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
ProductViewScreen(),
|
ProductViewScreen(),
|
||||||
ProductEditScreen.route: (context) =>
|
ProductEditScreen.route: (context) =>
|
||||||
ProductEditScreen(),
|
ProductEditScreen(),
|
||||||
ClientScreen.route: (context) =>
|
ClientScreen.route: (context) => ClientScreenBuilder(),
|
||||||
ClientScreenBuilder(),
|
ClientViewScreen.route: (context) => ClientViewScreen(),
|
||||||
ClientViewScreen.route: (context) =>
|
ClientEditScreen.route: (context) => ClientEditScreen(),
|
||||||
ClientViewScreen(),
|
|
||||||
ClientEditScreen.route: (context) =>
|
|
||||||
ClientEditScreen(),
|
|
||||||
ClientPdfScreen.route: (context) => ClientPdfScreen(),
|
ClientPdfScreen.route: (context) => ClientPdfScreen(),
|
||||||
InvoiceScreen.route: (context) =>
|
InvoiceScreen.route: (context) =>
|
||||||
InvoiceScreenBuilder(),
|
InvoiceScreenBuilder(),
|
||||||
|
|
@ -392,8 +387,7 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
InvoiceEditScreen(),
|
InvoiceEditScreen(),
|
||||||
InvoiceEmailScreen.route: (context) =>
|
InvoiceEmailScreen.route: (context) =>
|
||||||
InvoiceEmailScreen(),
|
InvoiceEmailScreen(),
|
||||||
InvoicePdfScreen.route: (context) =>
|
InvoicePdfScreen.route: (context) => InvoicePdfScreen(),
|
||||||
InvoicePdfScreen(),
|
|
||||||
DocumentScreen.route: (context) =>
|
DocumentScreen.route: (context) =>
|
||||||
DocumentScreenBuilder(),
|
DocumentScreenBuilder(),
|
||||||
DocumentViewScreen.route: (context) =>
|
DocumentViewScreen.route: (context) =>
|
||||||
|
|
@ -406,12 +400,9 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
ExpenseViewScreen(),
|
ExpenseViewScreen(),
|
||||||
ExpenseEditScreen.route: (context) =>
|
ExpenseEditScreen.route: (context) =>
|
||||||
ExpenseEditScreen(),
|
ExpenseEditScreen(),
|
||||||
VendorScreen.route: (context) =>
|
VendorScreen.route: (context) => VendorScreenBuilder(),
|
||||||
VendorScreenBuilder(),
|
VendorViewScreen.route: (context) => VendorViewScreen(),
|
||||||
VendorViewScreen.route: (context) =>
|
VendorEditScreen.route: (context) => VendorEditScreen(),
|
||||||
VendorViewScreen(),
|
|
||||||
VendorEditScreen.route: (context) =>
|
|
||||||
VendorEditScreen(),
|
|
||||||
TaskScreen.route: (context) => TaskScreenBuilder(),
|
TaskScreen.route: (context) => TaskScreenBuilder(),
|
||||||
TaskViewScreen.route: (context) => TaskViewScreen(),
|
TaskViewScreen.route: (context) => TaskViewScreen(),
|
||||||
TaskEditScreen.route: (context) => TaskEditScreen(),
|
TaskEditScreen.route: (context) => TaskEditScreen(),
|
||||||
|
|
@ -432,8 +423,7 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
QuoteScreen.route: (context) => QuoteScreenBuilder(),
|
QuoteScreen.route: (context) => QuoteScreenBuilder(),
|
||||||
QuoteViewScreen.route: (context) => QuoteViewScreen(),
|
QuoteViewScreen.route: (context) => QuoteViewScreen(),
|
||||||
QuoteEditScreen.route: (context) => QuoteEditScreen(),
|
QuoteEditScreen.route: (context) => QuoteEditScreen(),
|
||||||
QuoteEmailScreen.route: (context) =>
|
QuoteEmailScreen.route: (context) => QuoteEmailScreen(),
|
||||||
QuoteEmailScreen(),
|
|
||||||
QuotePdfScreen.route: (context) => QuotePdfScreen(),
|
QuotePdfScreen.route: (context) => QuotePdfScreen(),
|
||||||
// STARTER: routes - do not remove comment
|
// STARTER: routes - do not remove comment
|
||||||
RecurringExpenseScreen.route: (context) =>
|
RecurringExpenseScreen.route: (context) =>
|
||||||
|
|
@ -485,18 +475,12 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
PaymentTermEditScreen(),
|
PaymentTermEditScreen(),
|
||||||
PaymentTermViewScreen.route: (context) =>
|
PaymentTermViewScreen.route: (context) =>
|
||||||
PaymentTermViewScreen(),
|
PaymentTermViewScreen(),
|
||||||
DesignScreen.route: (context) =>
|
DesignScreen.route: (context) => DesignScreenBuilder(),
|
||||||
DesignScreenBuilder(),
|
DesignViewScreen.route: (context) => DesignViewScreen(),
|
||||||
DesignViewScreen.route: (context) =>
|
DesignEditScreen.route: (context) => DesignEditScreen(),
|
||||||
DesignViewScreen(),
|
CreditScreen.route: (context) => CreditScreenBuilder(),
|
||||||
DesignEditScreen.route: (context) =>
|
CreditViewScreen.route: (context) => CreditViewScreen(),
|
||||||
DesignEditScreen(),
|
CreditEditScreen.route: (context) => CreditEditScreen(),
|
||||||
CreditScreen.route: (context) =>
|
|
||||||
CreditScreenBuilder(),
|
|
||||||
CreditViewScreen.route: (context) =>
|
|
||||||
CreditViewScreen(),
|
|
||||||
CreditEditScreen.route: (context) =>
|
|
||||||
CreditEditScreen(),
|
|
||||||
CreditEmailScreen.route: (context) =>
|
CreditEmailScreen.route: (context) =>
|
||||||
CreditEmailScreen(),
|
CreditEmailScreen(),
|
||||||
CreditPdfScreen.route: (context) => CreditPdfScreen(),
|
CreditPdfScreen.route: (context) => CreditPdfScreen(),
|
||||||
|
|
@ -567,7 +551,6 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
: {},
|
: {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue