format code

This commit is contained in:
jyuesong
2022-01-18 09:29:45 +08:00
parent 917425c5de
commit 074580952f
40 changed files with 414 additions and 568 deletions

View File

@@ -7,7 +7,7 @@ class QlNavigatorObserver extends NavigatorObserver {
@override
void didPush(Route route, Route? previousRoute) {
super.didPush(route, previousRoute);
if (Routes.route_LOGIN == route.settings.name) {
if (Routes.routeLogin == route.settings.name) {
isInLoginPage = true;
} else {
isInLoginPage = false;

View File

@@ -1,14 +1,13 @@
import 'package:flutter/material.dart';
const qinglongLightTheme = {
'root':
TextStyle(color: Color(0xff333333), backgroundColor: Color(0xffffffff)),
TextStyle(color: Color(0xff333333), backgroundColor: Color(0xffffffff)),
'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'selector-tag':
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal),
'number': TextStyle(color: Color(0xff008080)),
'literal': TextStyle(color: Color(0xff008080)),
@@ -19,12 +18,12 @@ const qinglongLightTheme = {
'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'selector-id':
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold),
'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'attribute':
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'regexp': TextStyle(color: Color(0xff009926)),
'link': TextStyle(color: Color(0xff009926)),
'symbol': TextStyle(color: Color(0xff990073)),
@@ -39,13 +38,12 @@ const qinglongLightTheme = {
};
const qinglongDarkTheme = {
'root':
TextStyle(color: Color(0xff333333), backgroundColor: Colors.black),
'root': TextStyle(color: Color(0xff333333), backgroundColor: Colors.black),
'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'selector-tag':
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal),
'number': TextStyle(color: Color(0xff008080)),
'literal': TextStyle(color: Color(0xff008080)),
@@ -56,12 +54,12 @@ const qinglongDarkTheme = {
'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'selector-id':
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold),
'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'attribute':
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'regexp': TextStyle(color: Color(0xff009926)),
'link': TextStyle(color: Color(0xff009926)),
'symbol': TextStyle(color: Color(0xff990073)),

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fluttertoast/fluttertoast.dart';
extension ContextExt on BuildContext {
T read<T>(ProviderBase<T> provider) {
@@ -10,3 +11,15 @@ extension ContextExt on BuildContext {
return (this as WidgetRef).watch<T>(provider);
}
}
extension StringExt on String? {
void toast() {
if (this == null || this!.isEmpty) return;
Fluttertoast.showToast(
msg: this!,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
);
}
}

View File

@@ -56,7 +56,8 @@ class SpUtil {
}
/// get obj list.
static List<T>? getObjList<T>(String key, T f(Map v), {List<T> defValue = const []}) {
static List<T>? getObjList<T>(String key, T f(Map v),
{List<T> defValue = const []}) {
List<Map>? dataList = getObjectList(key);
List<T>? list = dataList?.map((value) {
return f(value);
@@ -123,7 +124,8 @@ class SpUtil {
}
/// get string list.
static List<String> getStringList(String key, {List<String> defValue = const []}) {
static List<String> getStringList(String key,
{List<String> defValue = const []}) {
if (_prefs == null) return defValue;
return _prefs!.getStringList(key) ?? defValue;
}
@@ -168,4 +170,4 @@ class SpUtil {
static bool isInitialized() {
return _prefs != null;
}
}
}