feat: fix some bugs.
This commit is contained in:
+10
-2
@@ -287,6 +287,8 @@ class _CherryToastState extends State<CherryToast> with TickerProviderStateMixin
|
||||
late Animation<Offset> offsetAnimation;
|
||||
late AnimationController slideController;
|
||||
late BoxDecoration toastDecoration;
|
||||
|
||||
bool _dismissed = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -311,7 +313,10 @@ class _CherryToastState extends State<CherryToast> with TickerProviderStateMixin
|
||||
Timer(this.widget.toastDuration, () {
|
||||
slideController.reverse();
|
||||
Timer(this.widget.animationDuration, () {
|
||||
if (mounted) Navigator.pop(context);
|
||||
if (mounted && !_dismissed) {
|
||||
_dismissed = true;
|
||||
Navigator.pop(context);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -463,7 +468,10 @@ class _CherryToastState extends State<CherryToast> with TickerProviderStateMixin
|
||||
onTap: () {
|
||||
slideController.reverse();
|
||||
Timer(this.widget.animationDuration, () {
|
||||
if (mounted) Navigator.pop(context);
|
||||
if (mounted && !_dismissed) {
|
||||
_dismissed = true;
|
||||
Navigator.pop(context);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Icon(Icons.close, color: Colors.grey[500], size: CLOSE_BUTTON_SIZE),
|
||||
|
||||
@@ -52,6 +52,8 @@ class Api {
|
||||
if (builder is GetStatusCodeFunc) return builder({"statusCode": resp.statusCode});
|
||||
T? res;
|
||||
try {
|
||||
if (resp.statusCode != HttpStatus.ok && resp.bodyBytes.length == 0)
|
||||
throw HttpErrorCode(resp.statusCode, message: 'No resp body');
|
||||
var decodeBody = json.decode(utf8.decode(resp.bodyBytes));
|
||||
res = decodeBody is Map ? builder(decodeBody) : builder({'list': decodeBody});
|
||||
} catch (e) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:dde_gesture_manager/utils/helper.dart';
|
||||
import 'package:dde_gesture_manager/utils/notificator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:markdown_editor_ot/markdown_editor.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DMarkdownField extends StatefulWidget {
|
||||
const DMarkdownField({
|
||||
|
||||
@@ -34,7 +34,6 @@ class _MarketWidgetState extends State<MarketWidget> {
|
||||
MarketSortType _type = MarketSortType.recommend;
|
||||
String? _selected;
|
||||
String? _hovering;
|
||||
int _refreshKey = 0;
|
||||
List<int> _likedSchemes = [];
|
||||
|
||||
@override
|
||||
|
||||
@@ -23,8 +23,7 @@ class TableCellShortcutListener extends StatefulWidget {
|
||||
|
||||
class _TableCellShortcutListenerState extends State<TableCellShortcutListener> {
|
||||
List<KeyNames> _shortcut = [];
|
||||
bool inputMode = false;
|
||||
FocusNode _focusNode = FocusNode();
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
|
||||
_handleFocusChange() {
|
||||
if (!_focusNode.hasFocus) {
|
||||
@@ -43,6 +42,7 @@ class _TableCellShortcutListenerState extends State<TableCellShortcutListener> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
var __shortcut = widget.initShortcut.split('+');
|
||||
__shortcut.forEach((name) {
|
||||
var keyNames = getPhysicalKeyNamesByRealName(name);
|
||||
@@ -50,7 +50,6 @@ class _TableCellShortcutListenerState extends State<TableCellShortcutListener> {
|
||||
});
|
||||
_shortcut.sort();
|
||||
_focusNode.addListener(_handleFocusChange);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -70,8 +69,8 @@ class _TableCellShortcutListenerState extends State<TableCellShortcutListener> {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_shortcut = [];
|
||||
inputMode = true;
|
||||
});
|
||||
_focusNode.requestFocus();
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
|
||||
Reference in New Issue
Block a user