fix(ui): Allow opening non-redesigned pages again
This commit is contained in:
parent
de84d5924b
commit
8928d3a34c
@ -77,6 +77,7 @@ import 'package:moxxyv2/ui/service/data.dart';
|
|||||||
import 'package:moxxyv2/ui/service/progress.dart';
|
import 'package:moxxyv2/ui/service/progress.dart';
|
||||||
import 'package:moxxyv2/ui/service/read.dart';
|
import 'package:moxxyv2/ui/service/read.dart';
|
||||||
import 'package:moxxyv2/ui/service/sharing.dart';
|
import 'package:moxxyv2/ui/service/sharing.dart';
|
||||||
|
import 'package:moxxyv2/ui/theme.dart';
|
||||||
import 'package:page_transition/page_transition.dart';
|
import 'package:page_transition/page_transition.dart';
|
||||||
|
|
||||||
void setupLogging() {
|
void setupLogging() {
|
||||||
@ -293,9 +294,15 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
|||||||
title: 'Moxxy',
|
title: 'Moxxy',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: light,
|
colorScheme: light,
|
||||||
|
extensions: [
|
||||||
|
getMoxxyThemeData(Brightness.light),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData(
|
darkTheme: ThemeData(
|
||||||
colorScheme: dark,
|
colorScheme: dark,
|
||||||
|
extensions: [
|
||||||
|
getMoxxyThemeData(Brightness.dark),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
navigatorKey: widget.navigationKey,
|
navigatorKey: widget.navigationKey,
|
||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
|
@ -367,7 +367,10 @@ class ConversationPageState extends State<ConversationPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final maxWidth = MediaQuery.of(context).size.width * 0.6;
|
final maxWidth = MediaQuery.of(context).size.width * 0.6;
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: !_keyboardController.currentData.visible && !_keyboardController.currentData.showWidget && !_conversationController.messagingController.isRecordingNotifier.value,
|
canPop: !_keyboardController.currentData.visible &&
|
||||||
|
!_keyboardController.currentData.showWidget &&
|
||||||
|
!_conversationController
|
||||||
|
.messagingController.isRecordingNotifier.value,
|
||||||
onPopInvoked: (didPop) {
|
onPopInvoked: (didPop) {
|
||||||
if (_keyboardController.currentData.visible) {
|
if (_keyboardController.currentData.visible) {
|
||||||
// If the keyboard is open, dismiss it.
|
// If the keyboard is open, dismiss it.
|
||||||
|
@ -82,7 +82,7 @@ class CropPage extends StatelessWidget {
|
|||||||
return PopScope(
|
return PopScope(
|
||||||
onPopInvoked: (_) {
|
onPopInvoked: (_) {
|
||||||
context.read<CropBloc>().add(ResetImageEvent());
|
context.read<CropBloc>().add(ResetImageEvent());
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: state.image != null
|
child: state.image != null
|
||||||
? _buildImageBody(context, state)
|
? _buildImageBody(context, state)
|
||||||
|
@ -123,7 +123,9 @@ class AccountsBottomModal extends StatelessWidget {
|
|||||||
final cubit = context.read<AccountCubit>();
|
final cubit = context.read<AccountCubit>();
|
||||||
final accounts = cubit.state.accounts;
|
final accounts = cubit.state.accounts;
|
||||||
final extent = clampDouble(
|
final extent = clampDouble(
|
||||||
((accounts.length + 1) * AccountListTile.height + mq.textScaler.scale(20)) / mq.size.height,
|
((accounts.length + 1) * AccountListTile.height +
|
||||||
|
mq.textScaler.scale(20)) /
|
||||||
|
mq.size.height,
|
||||||
0,
|
0,
|
||||||
0.9,
|
0.9,
|
||||||
);
|
);
|
||||||
|
@ -93,7 +93,9 @@ class CropBackgroundPageState extends State<CropBackgroundPage> {
|
|||||||
canPop: !state.isWorking,
|
canPop: !state.isWorking,
|
||||||
onPopInvoked: (didPop) {
|
onPopInvoked: (didPop) {
|
||||||
if (didPop) {
|
if (didPop) {
|
||||||
context.read<CropBackgroundBloc>().add(CropBackgroundResetEvent());
|
context
|
||||||
|
.read<CropBackgroundBloc>()
|
||||||
|
.add(CropBackgroundResetEvent());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
|
@ -89,6 +89,34 @@ MaterialStateProperty<Color> _makeEnabledDisabledProperty(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helper function to construct the ThemeData extension for Moxxy-specific theming.
|
||||||
|
// TODO(Unknown): Remove once we have an actual design for everything
|
||||||
|
MoxxyThemeData getMoxxyThemeData(Brightness brightness) {
|
||||||
|
if (brightness == Brightness.dark) {
|
||||||
|
return const MoxxyThemeData(
|
||||||
|
conversationTextFieldColor: conversationTextFieldColorDark,
|
||||||
|
profileFallbackBackgroundColor: profileFallbackBackgroundColorDark,
|
||||||
|
profileFallbackTextColor: profileFallbackTextColorDark,
|
||||||
|
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorDark,
|
||||||
|
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorDark,
|
||||||
|
conversationTextFieldHintTextColor: textFieldHintTextColorDark,
|
||||||
|
conversationTextFieldTextColor: textFieldTextColorDark,
|
||||||
|
conversationOverlayTextColor: conversationOverlayButtonTextColor,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const MoxxyThemeData(
|
||||||
|
conversationTextFieldColor: conversationTextFieldColorLight,
|
||||||
|
profileFallbackBackgroundColor: profileFallbackBackgroundColorLight,
|
||||||
|
profileFallbackTextColor: profileFallbackTextColorLight,
|
||||||
|
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorLight,
|
||||||
|
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorLight,
|
||||||
|
conversationTextFieldHintTextColor: textFieldHintTextColorLight,
|
||||||
|
conversationTextFieldTextColor: textFieldTextColorLight,
|
||||||
|
conversationOverlayTextColor: conversationOverlayButtonTextColor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Inspired by syphon's code: https://github.com/syphon-org/syphon/blob/dev/lib/global/themes.dart
|
// NOTE: Inspired by syphon's code: https://github.com/syphon-org/syphon/blob/dev/lib/global/themes.dart
|
||||||
ThemeData getThemeData(BuildContext context, Brightness brightness) {
|
ThemeData getThemeData(BuildContext context, Brightness brightness) {
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
@ -143,28 +171,7 @@ ThemeData getThemeData(BuildContext context, Brightness brightness) {
|
|||||||
),
|
),
|
||||||
|
|
||||||
extensions: [
|
extensions: [
|
||||||
if (brightness == Brightness.dark)
|
getMoxxyThemeData(brightness),
|
||||||
const MoxxyThemeData(
|
|
||||||
conversationTextFieldColor: conversationTextFieldColorDark,
|
|
||||||
profileFallbackBackgroundColor: profileFallbackBackgroundColorDark,
|
|
||||||
profileFallbackTextColor: profileFallbackTextColorDark,
|
|
||||||
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorDark,
|
|
||||||
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorDark,
|
|
||||||
conversationTextFieldHintTextColor: textFieldHintTextColorDark,
|
|
||||||
conversationTextFieldTextColor: textFieldTextColorDark,
|
|
||||||
conversationOverlayTextColor: conversationOverlayButtonTextColor,
|
|
||||||
)
|
|
||||||
else
|
|
||||||
const MoxxyThemeData(
|
|
||||||
conversationTextFieldColor: conversationTextFieldColorLight,
|
|
||||||
profileFallbackBackgroundColor: profileFallbackBackgroundColorLight,
|
|
||||||
profileFallbackTextColor: profileFallbackTextColorLight,
|
|
||||||
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorLight,
|
|
||||||
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorLight,
|
|
||||||
conversationTextFieldHintTextColor: textFieldHintTextColorLight,
|
|
||||||
conversationTextFieldTextColor: textFieldTextColorLight,
|
|
||||||
conversationOverlayTextColor: conversationOverlayButtonTextColor,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,9 @@ class ContextMenu extends StatelessWidget {
|
|||||||
|
|
||||||
/// Computes the height of the context menu, given the number of items.
|
/// Computes the height of the context menu, given the number of items.
|
||||||
static double computeHeight(BuildContext context, int numberItems) {
|
static double computeHeight(BuildContext context, int numberItems) {
|
||||||
return 2 * pxToLp(24) + numberItems * (pxToLp(48) + MediaQuery.of(context).textScaler.scale(32));
|
return 2 * pxToLp(24) +
|
||||||
|
numberItems *
|
||||||
|
(pxToLp(48) + MediaQuery.of(context).textScaler.scale(32));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
Reference in New Issue
Block a user