mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 04:57:23 +00:00
Migrate to flutter 3.27.0
This commit is contained in:
@@ -143,15 +143,15 @@ class _CommentsPageState extends MultiPageLoadingState<CommentsPage, Comment> {
|
||||
return Card(
|
||||
padding: EdgeInsets.zero,
|
||||
backgroundColor:
|
||||
FluentTheme.of(context).micaBackgroundColor.withOpacity(0.96),
|
||||
FluentTheme.of(context).micaBackgroundColor.toOpacity(0.96),
|
||||
child: SizedBox(
|
||||
height: 52,
|
||||
child: TextBox(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
placeholder: "Comment".tl,
|
||||
foregroundDecoration: BoxDecoration(
|
||||
foregroundDecoration: WidgetStatePropertyAll(BoxDecoration(
|
||||
border: Border.all(color: Colors.transparent),
|
||||
),
|
||||
)),
|
||||
onSubmitted: (s) {
|
||||
showToast(context, message: "Sending".tl);
|
||||
if (isCommenting) return;
|
||||
@@ -161,10 +161,12 @@ class _CommentsPageState extends MultiPageLoadingState<CommentsPage, Comment> {
|
||||
if (widget.isNovel) {
|
||||
Network().commentNovel(widget.id, s).then((value) {
|
||||
if (value.error) {
|
||||
context.showToast(message: "Network Error");
|
||||
setState(() {
|
||||
isCommenting = false;
|
||||
});
|
||||
if (context.mounted) {
|
||||
context.showToast(message: "Network Error");
|
||||
setState(() {
|
||||
isCommenting = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
isCommenting = false;
|
||||
nextUrl = null;
|
||||
@@ -174,10 +176,12 @@ class _CommentsPageState extends MultiPageLoadingState<CommentsPage, Comment> {
|
||||
} else {
|
||||
Network().comment(widget.id, s).then((value) {
|
||||
if (value.error) {
|
||||
context.showToast(message: "Network Error");
|
||||
setState(() {
|
||||
isCommenting = false;
|
||||
});
|
||||
if(context.mounted) {
|
||||
context.showToast(message: "Network Error");
|
||||
setState(() {
|
||||
isCommenting = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
isCommenting = false;
|
||||
nextUrl = null;
|
||||
|
@@ -620,7 +620,7 @@ class _BottomBarState extends State<_BottomBar> with TickerProviderStateMixin {
|
||||
borderRadius:
|
||||
const BorderRadius.vertical(top: Radius.circular(8)),
|
||||
backgroundColor:
|
||||
FluentTheme.of(context).micaBackgroundColor.withOpacity(0.96),
|
||||
FluentTheme.of(context).micaBackgroundColor.toOpacity(0.96),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -1219,7 +1219,7 @@ class __BlockingPageState extends State<_BlockingPage> {
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
borderColor: blockedTags.contains(index)
|
||||
? ColorScheme.of(context).outlineVariant
|
||||
: ColorScheme.of(context).outlineVariant.withOpacity(0.2),
|
||||
: ColorScheme.of(context).outlineVariant.toOpacity(0.2),
|
||||
padding: EdgeInsets.zero,
|
||||
child: ListTile(
|
||||
title: Text(text),
|
||||
|
@@ -122,7 +122,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
|
||||
await file.readAsBytes(),
|
||||
quality: 100,
|
||||
name: fileName);
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
showToast(context, message: "Saved".tl);
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ class _LogsPageState extends State<LogsPage> {
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorScheme.of(context).surfaceVariant,
|
||||
color: ColorScheme.of(context).surfaceContainerHighest,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
child: Padding(
|
||||
|
@@ -129,7 +129,7 @@ class _MainPageState extends State<MainPage>
|
||||
);
|
||||
}
|
||||
return DefaultSelectionStyle.merge(
|
||||
selectionColor: FluentTheme.of(context).selectionColor.withOpacity(0.4),
|
||||
selectionColor: FluentTheme.of(context).selectionColor.toOpacity(0.4),
|
||||
child: NavigationView(
|
||||
appBar: buildAppBar(context, navigatorKey),
|
||||
pane: NavigationPane(
|
||||
@@ -355,9 +355,7 @@ class _MainPageState extends State<MainPage>
|
||||
ValueListenable<bool> get canPopNotifier => popValue;
|
||||
|
||||
@override
|
||||
PopInvokedCallback? get onPopInvoked => onPop;
|
||||
|
||||
void onPop(bool value) {
|
||||
void onPopInvokedWithResult(bool didPop, result) {
|
||||
if (App.rootNavigatorKey.currentState?.canPop() ?? false) {
|
||||
App.rootNavigatorKey.currentState?.pop();
|
||||
} else if (App.mainNavigatorKey?.currentState?.canPop() ?? false) {
|
||||
@@ -366,6 +364,9 @@ class _MainPageState extends State<MainPage>
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onPopInvoked(bool didPop) { }
|
||||
}
|
||||
|
||||
class _BackButton extends StatefulWidget {
|
||||
@@ -416,7 +417,7 @@ class _BackButtonState extends State<_BackButton> {
|
||||
|
||||
return NavigationPaneTheme(
|
||||
data: NavigationPaneTheme.of(context).merge(NavigationPaneThemeData(
|
||||
unselectedIconColor: ButtonState.resolveWith((states) {
|
||||
unselectedIconColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.isDisabled) {
|
||||
return ButtonThemeData.buttonColor(context, states);
|
||||
}
|
||||
@@ -669,16 +670,16 @@ class UserPane extends PaneItem {
|
||||
final tileColor = this.tileColor ??
|
||||
theme.tileColor ??
|
||||
kDefaultPaneItemColor(context, mode == PaneDisplayMode.top);
|
||||
final newStates = states.toSet()..remove(ButtonStates.disabled);
|
||||
final newStates = states.toSet()..remove(WidgetState.disabled);
|
||||
if (selected && selectedTileColor != null) {
|
||||
return selectedTileColor!.resolve(newStates);
|
||||
}
|
||||
return tileColor.resolve(
|
||||
selected
|
||||
? {
|
||||
states.isHovering
|
||||
? ButtonStates.pressing
|
||||
: ButtonStates.hovering,
|
||||
states.isHovered
|
||||
? WidgetState.pressed
|
||||
: WidgetState.hovered,
|
||||
}
|
||||
: newStates,
|
||||
);
|
||||
|
@@ -214,7 +214,7 @@ class _NovelPageState extends State<NovelPage> {
|
||||
constraints: const BoxConstraints(maxWidth: 560),
|
||||
child: Card(
|
||||
margin: const EdgeInsets.only(left: 2, right: 2, bottom: 12),
|
||||
borderColor: ColorScheme.of(context).outlineVariant.withOpacity(0.52),
|
||||
borderColor: ColorScheme.of(context).outlineVariant.toOpacity(0.52),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
@@ -555,7 +555,7 @@ class _NovelSeriesWidgetState
|
||||
color: FluentTheme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context).outlineVariant.withOpacity(0.6),
|
||||
color: ColorScheme.of(context).outlineVariant.toOpacity(0.6),
|
||||
width: 0.5,
|
||||
)),
|
||||
sliver: SliverMainAxisGroup(slivers: [
|
||||
|
@@ -105,12 +105,13 @@ class _SearchPageState extends State<SearchPage> {
|
||||
'${searchTypes[searchType].tl} / ${"Open link".tl}',
|
||||
onChanged: (s) => text = s,
|
||||
onSubmitted: (s) => search(),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.withOpacity(0.6)),
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
foregroundDecoration: WidgetStatePropertyAll(
|
||||
BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.toOpacity(0.6)),
|
||||
borderRadius: BorderRadius.circular(4))),
|
||||
suffix: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
@@ -247,7 +248,7 @@ class _TrendingTagsViewState
|
||||
decoration: BoxDecoration(
|
||||
color: FluentTheme.of(context)
|
||||
.micaBackgroundColor
|
||||
.withOpacity(0.84),
|
||||
.toOpacity(0.84),
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
child: Text(text)
|
||||
.paddingHorizontal(4)
|
||||
@@ -517,12 +518,16 @@ class _SearchResultPageState
|
||||
placeholder: "Search artworks".tl,
|
||||
onChanged: (s) => keyword = s,
|
||||
onSubmitted: (s) => search(),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
foregroundDecoration: WidgetStatePropertyAll(
|
||||
BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.withOpacity(0.6)),
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.toOpacity(0.6),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
suffix: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
@@ -709,12 +714,14 @@ class _SearchNovelResultPageState
|
||||
placeholder: "Search artworks".tl,
|
||||
onChanged: (s) => keyword = s,
|
||||
onSubmitted: (s) => search(),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.withOpacity(0.6)),
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
foregroundDecoration: WidgetStatePropertyAll(
|
||||
BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorScheme.of(context)
|
||||
.outlineVariant
|
||||
.toOpacity(0.6)),
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
),
|
||||
suffix: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
|
Reference in New Issue
Block a user