提交 c0c76817 authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!9
......@@ -44,7 +44,7 @@ class _AdPageState extends State<AdPage> {
),
child: Text(
'跳过 ${controller._countdown} s',
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white,fontSize:14.w,),
),
),
)
......
......@@ -30,7 +30,7 @@ class BuildBook extends StatelessWidget {
children: [
CustomCard(
url: model.img ?? '',
height: 110.w,
height: 120.w,
width: 100.w,
)
],
......@@ -41,7 +41,7 @@ class BuildBook extends StatelessWidget {
Expanded(
child: Container(
// color: Colors.cyan,
padding: EdgeInsets.only(top: 12.w, bottom: 15.w),
padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
......
......@@ -38,7 +38,13 @@ class _LibraryContentPageState extends State<LibraryContentPage> with AutomaticK
context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()});
},
child: LibraryCell(model: model,onTap: (){
widget.controller.love(model: model);
if(UserStore.to.isLogin){
widget.controller.love(model: model);
}
else{
context.pushNamed(Routes.login);
}
},),
);
}
......
......@@ -89,7 +89,7 @@ class LoginController extends GetxController {
/// 测试账号
if (kDebugMode) {
phoneInput.text = '13521054068';
passwordInput.text = 'zj123456';
passwordInput.text = '12345678';
// phoneInput.text = '17311837355';
// passwordInput.text = '12345678';
}
......@@ -138,14 +138,18 @@ class LoginController extends GetxController {
// 存储用户信息
await Future.wait([
UserStore.to.setToken(result.token!),
UserStore.to.setAccessToken(result.accessToken!),
]);
await Future.wait([
UserStore.to.setInfo(result),
UserStore.to.profile(),
UserStore.to.login(result)
]);
// await Future.wait([
// UserStore.to.setToken(result.token!),
// UserStore.to.setAccessToken(result.accessToken!),
//
// ]);
//
// await Future.wait([
// UserStore.to.setInfo(result),
// UserStore.to.profile(),
// ]);
if (!context.mounted) return;
if (context.canPop()){
......
......@@ -49,7 +49,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool get show => _show;
// 录音
final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder();
final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error);
// 录音开始
bool startRecording = false;
// 是否存在离线文件
......@@ -635,6 +635,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
Console.log('解压缩文件:$fileName,保存路径:$filePath');
}
}
CustomToast.dismiss();
Toast.show('离线成功');
final exit = await _isExistFile(bookId);
update();
......@@ -842,7 +843,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
/// 添加阅读时长
void _addReadTime({required type}) async{
final result = await LibraryAPI.addReadTime(bookId: bookId, readTypes: type);
Console.log('-------------$result-------------------');
}
/// 获取离线文件路径
void getBookDown() async{
......@@ -852,6 +852,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
else{
CustomToast.loading();
final result = await LibraryAPI.getbookDownloadParam(bookId: bookId);
Console.log('----------_getBookDown------------------${result.download}');
......
......@@ -23,6 +23,7 @@ import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import 'package:just_audio/just_audio.dart' as just_audio;
import 'package:logger/logger.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:async';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
......
......@@ -50,13 +50,21 @@ class NoteController extends GetxController {
update();
}
void delNotes({required String notesId,required String bookId}) async {
final result = await MineAPI.delNotes(notesId: notesId, bookId: bookId);
void delNotes({required NoteModel noteModel,required String bookId}) async {
final result = await MineAPI.delNotes(notesId: noteModel.notesId.toString(), bookId: bookId);
if (result){
Toast.show('删除笔记成功');
onRefresh();
notes.remove(noteModel);
}
update();
}
// void delNotes({required String notesId,required String bookId}) async {
// final result = await MineAPI.delNotes(notesId: notesId, bookId: bookId);
// if (result){
// Toast.show('删除笔记成功');
// onRefresh();
// }
// }
// 播放音频
void playAudio(MediaModel mediaModel){
......
......@@ -262,19 +262,6 @@ class _ReadPageState extends State<ReadPage> {
},
),
// AnimatedPositioned(
// duration: readController.controller.duration!,
// curve: Curves.easeInOut,
// top: readController.show ? 0 : -100, // 负值隐藏,0 显示
// left: 0,
// right: 0,
// height: 100,
// child: Container(
// color: Colors.limeAccent,
// alignment: Alignment.center,
// child: Text('top View'),
// ),
// ),
Positioned(
left: 0,
right: 0,
......@@ -282,19 +269,6 @@ class _ReadPageState extends State<ReadPage> {
bottom: 69,
child: _showContent(readController,readController.toolModel)
),
// AnimatedPositioned(
// duration: readController.controller.duration!,
// curve: Curves.easeInOut,
// bottom: readController.show ? 0 : -49 - MediaQuery.of(context).viewInsets.bottom, // 负值隐藏,0 显示
// left: 0,
// right: 0,
// height: 49,
// child: Container(
// color: Colors.limeAccent,
// alignment: Alignment.center,
// child: _createToolBar(readController)
// ),
// ),
/// 底部工具栏布局
Visibility(
visible: readController.show,
......@@ -400,14 +374,12 @@ class _ReadPageState extends State<ReadPage> {
// 点 搜索全部 列表 某一项 事件
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------目录点击搜索条目---------------------');
// 加载阅读界面 参数:chapter_id text
controller.sModel = sModel;
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
},
onTapChapter: (ChapterModel chapterModel){
Console.log('-----------选择的章节-------------${chapterModel.name}--------');
// 配置选择的章节
controller.selectChapter(chapterModel);
// 取消选中 tool
......@@ -426,8 +398,7 @@ class _ReadPageState extends State<ReadPage> {
// 点 搜索全部 列表 某一项 事件
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------笔记点击搜索条目---------------------');
// 重新加载阅读界面 参数:chapter_id text
controller.sModel = sModel;
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
......@@ -446,8 +417,7 @@ class _ReadPageState extends State<ReadPage> {
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
controller.sModel = sModel;
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------讨论点击搜索条目---------------------');
// 重新加载阅读界面 参数:chapter_id text
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
},
......@@ -459,7 +429,6 @@ class _ReadPageState extends State<ReadPage> {
}
/// 目录、评论、笔记 背景
Widget _showContent(ReadController controller,ToolModel model) {
Console.log('++++++++++++++++++++++++${model.tag}');
if (controller.show){
if(model.selected){
return GestureDetector(
......
......@@ -103,11 +103,21 @@ class _ReadNotePageState extends State<ReadNotePage> {
NoteModel model = controller.notes[index];
// 划线
if(model.types == 1){
return BuildLine(model: model,);
return BuildLine(
model: model,
onTapDel: (){
controller.delNotes(noteModel: model, bookId:widget.bookDetailModel.bookId.toString());
},
);
}
// 高亮
else if(model.types == 2){
return BuildHigh(model: model,);
return BuildHigh(
model: model,
onTapDel: (){
controller.delNotes(noteModel: model, bookId:widget.bookDetailModel.bookId.toString());
},
);
}
// 笔记
else if(model.types == 3){
......@@ -117,7 +127,10 @@ class _ReadNotePageState extends State<ReadNotePage> {
controller.playAudio(mediaModel);
},
onTapDel: (){
controller.delNotes(notesId: model.notesId.toString(), bookId:widget.bookDetailModel.bookId.toString());
controller.delNotes(noteModel: model, bookId:widget.bookDetailModel.bookId.toString());
},
onTapEdit: (){
context.pushNamed(Routes.editNote,extra: model,queryParameters: {'book_id':widget.bookDetailModel.bookId});
},
);
}
......
......@@ -21,7 +21,18 @@ class _StudyHistoryPageState extends State<StudyHistoryPage> {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
child:controller.histories.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
): ListView.builder(
itemBuilder: (BuildContext context, int index) {
return BuildDayItem(
historyModel: controller.histories[index],
......
......@@ -13,6 +13,12 @@ class UserCoinController extends GetxController {
int _page = 1;
bool _noMore = false;
@override
void onReady() {
onRefresh();
super.onReady();
}
@override
void onClose() {
refreshController.dispose();
......
......@@ -43,7 +43,18 @@ class _UserCoinPageState extends State<UserCoinPage> {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: Container(
child: controller.coins.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
......
......@@ -16,6 +16,12 @@ class UserCouponController extends GetxController {
int _page = 1;
bool _noMore = false;
@override
void onReady() {
onRefresh();
super.onReady();
}
@override
void onClose() {
refreshController.dispose();
......
......@@ -27,7 +27,18 @@ class _UserCouponPageState extends State<UserCouponPage> {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
child: controller.coupons.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildItem(model: controller.coupons[index],);
// if (index == controller.coupons.length){
......
......@@ -14,6 +14,11 @@ class UserLoveController extends GetxController {
// 收藏数据
List<CourseModel> loves = [];
@override
void onReady() {
onRefresh();
super.onReady();
}
@override
void onClose() {
......
......@@ -28,7 +28,18 @@ class _UserLovePageState extends State<UserLovePage> {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
child: controller.loves.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
CourseModel model = controller.loves[index];
return GestureDetector(
......
......@@ -13,6 +13,11 @@ class MsgController extends GetxController {
int _page = 1;
bool _noMore = false;
@override
void onReady() {
onRefresh();
super.onReady();
}
@override
void onClose() {
......
......@@ -25,7 +25,18 @@ class MsgPage extends StatelessWidget {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
child:controller.msgs.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
): ListView.builder(
itemBuilder: (BuildContext context, int index){
MsgModel model = controller.msgs[index];
return GestureDetector(
......
......@@ -129,7 +129,7 @@ class BuildNote extends StatelessWidget {
return text;
}
String _showImageStatus(NoteModel discussModel,MediaModel? mediaModel){
String _showMediaModelStatus(NoteModel discussModel,MediaModel? mediaModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
......@@ -186,7 +186,7 @@ class BuildNote extends StatelessWidget {
child: Container(
alignment: Alignment.center,
// color: model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text(_showImageStatus(model,mediaModel),style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
child: Text(_showMediaModelStatus(model,mediaModel),style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
)
),
),
......@@ -206,34 +206,43 @@ class BuildNote extends StatelessWidget {
MediaModel mediaModel = model.noteContent!.audio![index];
return Container(
height: 20.w,
margin: EdgeInsets.only(right: 130.w),
child: Container(
margin: EdgeInsets.only(top: 5.w),
padding: EdgeInsets.only(right:20.w,left: 10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.w),
color: Colours.cF9,
),
child: Row(
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment:MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: (){
// 我的录音 或者 已经审核通过的录音才可以播放
if(model.isMy == 1 || mediaModel.privacyStatus == 1){
if (onTapAudio !=null) onTapAudio!(mediaModel);
}
else{
Toast.show('当前音频处于审核中');
}
// margin: EdgeInsets.only(right: 130.w),
color: Colors.white,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(top: 5.w),
padding: EdgeInsets.only(right:15.w,left: 10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.w),
color: Colours.cF9,
),
child: Row(
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment:MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: (){
if (onTapAudio !=null) onTapAudio!(mediaModel);
// // 我的录音 或者 已经审核通过的录音才可以播放
// if(model.isMy == 1 || mediaModel.privacyStatus == 1){
// if (onTapAudio !=null) onTapAudio!(mediaModel);
// }
// else{
// Toast.show('当前音频处于审核中');
// }
},
child: Image.asset('assets/images/audio.png')
},
child: Image.asset('assets/images/audio.png')
),
Gaps.hGaps30,
Text('${mediaModel.currentDuration}/${mediaModel.duration}',style: TextStyle(fontSize: 10.w,height: 1.4,color: Colours.c9),),
],
),
Text('${mediaModel.currentDuration}/${mediaModel.duration}',style: TextStyle(fontSize: 10.w,height: 1.4,color: Colours.c9),)
],
),
),
Text(_showMediaModelStatus(model,mediaModel),style: TextStyle(fontSize: 11.w,height: 1.8,color: AppTheme.primary),)
],
),
);
},
......
......@@ -21,7 +21,7 @@ class UserOrderController extends GetxController
@override
void onReady() {
// onRefresh();
onRefresh();
super.onReady();
}
......
......@@ -37,7 +37,18 @@ class _BuildListPageState extends State<BuildListPage>
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: ListView.builder(
child: controller.orderList.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index) {
OrderListModel model = controller.orderList[index];
// OrderListModel model = widget.models[index];
......
......@@ -13,6 +13,12 @@ class UserPointController extends GetxController {
int _page = 1;
bool _noMore = false;
@override
void onReady() {
onRefresh();
super.onReady();
}
@override
void onClose() {
refreshController.dispose();
......
......@@ -25,7 +25,18 @@ class _UserPointPageState extends State<UserPointPage> {
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: Container(
child: controller.points.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
......
......@@ -140,7 +140,16 @@ abstract class Routes {
initialLocation: '/$splash',
// initialLocation: '/',
observers: [observer],
// redirect: (context, state) => _RouteRedirect.auth(),
refreshListenable:UserStore.to.needLogin,
redirect: (context, state) {
final currentRoute = state.matchedLocation;
final loginRoute = state.namedLocation(login);
final mainRoute = state.namedLocation(main);
if (currentRoute.contains(mainRoute)) return null;
if(currentRoute.contains(loginRoute)) return null;
if(!UserStore.to.isLogin) return loginRoute;
return null;
},
routes: [
GoRoute(
path: '/$splash',
......
......@@ -99,9 +99,6 @@ class HttpService extends GetxService {
try {
final requestOptions = options ?? Options();
requestOptions.headers = _getHeaders(excludeToken: excludeToken,params: params,url: url);
Console.log('----headers------${requestOptions.headers}');
Console.log('----params------$params');
// 如果启用缓存,将cacheEnabled参数添加到请求选项中
if(cacheEnabled){
requestOptions.extra ??= {};
......@@ -114,6 +111,7 @@ class HttpService extends GetxService {
cancelToken: cancelToken,
);
if (showLoading) CustomToast.dismiss();
Console.log('----headers------${requestOptions.headers}\n----params------$params-----');
Console.log(response.data);
return ResponseModel.fromJson(response.data);
} catch (error){
......@@ -237,6 +235,7 @@ class _RequestInterceptor extends Interceptor {
case DioExceptionType.badResponse:
final response = err.response;
final statusCode = response?.statusCode;
final code = int.tryParse(response?.data['code']?.toString() ?? '');
Console.log('************* ${response?.data}');
Console.log('******statusCode******* $statusCode');
// Console.log(response?.data);
......@@ -287,14 +286,15 @@ class _RequestInterceptor extends Interceptor {
msg = '$statusCode - Bad gateway';
// CustomToast.fail(msg);
break;
case 3000:
default:
// if (code == 901) UserStore.to.logout();
// msg = response?.data?['msg']?.toString() ?? msg;
msg = response?.data?['message']?.toString() ?? msg;
CustomToast.fail(msg);
if(code == 3001){
// Toast.show(msg);
CustomToast.info(msg);
}
else{
CustomToast.fail(msg);
}
break;
}
break;
......@@ -313,6 +313,7 @@ class _RequestInterceptor extends Interceptor {
Future<String?> refreshToken() async {
Console.log('--------refreshToken----------------');
final result = await HttpService.to.post(
'/v1/members/login/getToken',
params: {
......@@ -320,6 +321,12 @@ class _RequestInterceptor extends Interceptor {
}
);
if (result.data is Map) {
final String token = result.data['token'];
final String accessToken = result.data['access_token'];
if(token.isEmpty && accessToken.isEmpty){
UserStore.to.logout();
return null;
}
await Future.wait([
UserStore.to.setToken(result.data['token']),
UserStore.to.setAccessToken(result.data['access_token']),
......@@ -345,7 +352,7 @@ class _CacheInterceptor extends Interceptor {
// 在发起请求之前,检查缓存是否存在有效数据
String cacheKey = '${options.uri.toString()}?${options.data}';
final cachedFile = await DefaultCacheManager().getFileFromCache(cacheKey);
Console.log('获取数据----------cacheKey-----------------------$cacheKey');
// Console.log('获取数据----------cacheKey-----------------------$cacheKey');
if (cachedFile != null && cachedFile.validTill.isAfter(DateTime.now())) {
// 如果缓存有效,直接返回缓存数据
final cachedData = await cachedFile.file.readAsBytes();
......@@ -374,7 +381,7 @@ class _CacheInterceptor extends Interceptor {
final requestBody = response.requestOptions.data.toString();
// 将 GET 请求的参数和请求体参数拼接成缓存的键
final cacheKey = requestBody.isEmpty ? url : '$url?$requestBody';
Console.log('----------cacheKey-----------------------$cacheKey');
// Console.log('----------cacheKey-----------------------$cacheKey');
// 将响应数据转换为字符串,并将其编码为字节列表
List<int> bytes = utf8.encode(jsonEncode(response.data));
Uint8List uint8List = Uint8List.fromList(bytes);
......
part of store;
class UserStore extends GetxController {
class UserStore extends GetxController{
// 获取 UserStore 实例
static UserStore get to => Get.find();
......@@ -21,6 +21,10 @@ class UserStore extends GetxController {
UserModel _info = UserModel();
UserModel get info => _info;
// 是否需要登录
final ValueNotifier<bool> _needLogin = ValueNotifier<bool>(false);
ValueNotifier<bool> get needLogin => _needLogin;
@override
......@@ -29,6 +33,17 @@ class UserStore extends GetxController {
_token = StorageService.to.getString(kLocalToken);
}
Future<void>login(UserModel value) async{
_token = value.token??'';
_accessToken = value.accessToken??'';
await StorageService.to.setString(kLocalToken,_token);
await StorageService.to.setString(kLocalAccessToken, value.accessToken??'');
await StorageService.to.setString(kLocalUserInfo, jsonEncode(value.toJson()));
_needLogin.value = false;
_info = value;
_isLogin = true;
update();
}
Future<void> setToken(String value) async {
await StorageService.to.setString(kLocalToken, value);
_token = value;
......@@ -41,6 +56,7 @@ class UserStore extends GetxController {
Future<void> setInfo(UserModel value) async {
await StorageService.to.setString(kLocalUserInfo, jsonEncode(value.toJson()));
_needLogin.value = false;
_info = value;
}
......@@ -51,6 +67,7 @@ class UserStore extends GetxController {
await StorageService.to.remove(kLocalUserInfo);
_token = '';
_isLogin = false;
_needLogin.value = true;
}
Future<void> profile() async {
......
......@@ -53,10 +53,8 @@ class SqlManager {
static Future<Database?> getCurrentDatabase() async {
if (_database == null) {
Console.log('Sql-------------getCurrentDatabase---------------_database == null----');
await init();
}
Console.log('Sql-------------getCurrentDatabase---------------$_database');
return _database;
}
......
......@@ -47,6 +47,7 @@ class Gaps {
static Widget hGaps8 = SizedBox(width: 8.w,);
static Widget hGaps15 = SizedBox(width: 15.w,);
static Widget hGaps20 = SizedBox(width: 20.w,);
static Widget hGaps30 = SizedBox(width: 30.w,);
static Widget vGaps5 = SizedBox(height: 5.w,);
static Widget vGaps8 = SizedBox(height: 8.w,);
......
......@@ -35,6 +35,7 @@ abstract class CustomToast {
..userInteractions = true
..successWidget = const CustomToastSuccess()
..errorWidget = const CustomToastFail()
..infoWidget = const CustomToastInfo()
..indicatorWidget = CustomLoadingIndicator(size: 60.w)
..dismissOnTap = false;
return EasyLoading.init(builder: builder);
......@@ -54,6 +55,13 @@ abstract class CustomToast {
EasyLoading.showSuccess(text);
}
static void info(String text) {
EasyLoading.instance
..maskType = EasyLoadingMaskType.clear
..userInteractions = true;
EasyLoading.showInfo(text);
}
static void fail(String text) {
EasyLoading.instance
..maskType = EasyLoadingMaskType.clear
......@@ -96,3 +104,15 @@ class CustomToastSuccess extends StatelessWidget {
);
}
}
class CustomToastInfo extends StatelessWidget {
const CustomToastInfo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Icon(
Icons.info,
color: Theme.of(context).colorScheme.primary,
size: 60.w,
);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论