feat: optimize ui

This commit is contained in:
louis 2024-03-22 17:26:57 +08:00
parent f325cce223
commit 9e39aa8c41
38 changed files with 294 additions and 265 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

View File

@ -15,7 +15,7 @@ class AppTheme {
static const Color nearlyWhite = Color(0xFFFEFEFE); static const Color nearlyWhite = Color(0xFFFEFEFE);
static const Color black = Color(0xFF000000); static const Color black = Color(0xFF000000);
static const Color nearlyBlack = Color(0xFF213333); static const Color nearlyBlack = Color(0xFF213333);
static const Color grey = Color(0xFF3A5160); static const Color grey = Color.fromARGB(255, 98, 101, 102);
static const Color snackbarErrorBackgroudColor = Colors.red; static const Color snackbarErrorBackgroudColor = Colors.red;
static const Color snackbarSuccessBackgroudColor = Colors.green; static const Color snackbarSuccessBackgroudColor = Colors.green;
static const Color snackbarWarningBackgroudColor = Colors.orange; static const Color snackbarWarningBackgroudColor = Colors.orange;

View File

@ -8,6 +8,6 @@ enum InventoryInOrOutEnum { In, Out }
// InventoryInOrOutEnum // InventoryInOrOutEnum
const Map<InventoryInOrOutEnum, int> InventoryInOrOutEnumValues = { const Map<InventoryInOrOutEnum, int> InventoryInOrOutEnumValues = {
InventoryInOrOutEnum.In: 1, InventoryInOrOutEnum.In: 0,
InventoryInOrOutEnum.Out: 2, InventoryInOrOutEnum.Out: 1,
}; };

View File

@ -50,9 +50,9 @@ class IndexPage extends StatelessWidget {
if (AppInfoService.to.checkIsFirstInstall()) { if (AppInfoService.to.checkIsFirstInstall()) {
// app打开的页面 // app打开的页面
} }
return StorageService.to.getString(CacheKeys.token, isWithUser: false) == final token =
null StorageService.to.getString(CacheKeys.token, isWithUser: false);
? RouteConfig.login bool isLogined = token != null;
: RouteConfig.home; return isLogined ? RouteConfig.home : RouteConfig.login;
} }
} }

View File

@ -18,14 +18,16 @@ class ChangeButtonRow extends StatelessWidget {
children: [ children: [
const TodayButton(), const TodayButton(),
const Spacer(), const Spacer(),
InkWell( ClipOval(
onTap: () => controller.onMoveBack(), child: InkWell(
child: ChangeIconButton( onTap: () => controller.onMoveBack(),
icon: Icon( child: ChangeIconButton(
Icons.arrow_back_ios_rounded, icon: Icon(
color: Colors.white, Icons.arrow_back_ios_rounded,
size: ScreenAdaper.sp(30), color: Colors.white,
))), size: ScreenAdaper.sp(30),
)),
)),
const SizedBox( const SizedBox(
width: defaultPadding, width: defaultPadding,
), ),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart';
@ -11,13 +12,16 @@ class ChangeIconButton extends StatelessWidget {
height: ScreenAdaper.height(60), height: ScreenAdaper.height(60),
width: ScreenAdaper.height(60), width: ScreenAdaper.height(60),
alignment: Alignment.center, alignment: Alignment.center,
decoration: decoration: BoxDecoration(
BoxDecoration(shape: BoxShape.circle, color: neviBlue, boxShadow: [ shape: BoxShape.circle,
BoxShadow( gradient: const LinearGradient(
color: neviBlue.withOpacity(.3), colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]),
offset: Offset(0, ScreenAdaper.height(10)), boxShadow: [
blurRadius: ScreenAdaper.sp(10)) BoxShadow(
]), color: neviBlue.withOpacity(.3),
offset: Offset(0, ScreenAdaper.height(10)),
blurRadius: ScreenAdaper.sp(10))
]),
child: icon, child: icon,
); );
} }

View File

@ -1,14 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/config.dart'; import 'package:sk_base_mobile/config.dart';
import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/constants/enum.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/inventory_inout_card_content.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart'; import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/util.dart'; import 'package:sk_base_mobile/util/util.dart';
import 'package:sk_base_mobile/widgets/fade_in_cache_image.dart'; import 'package:sk_base_mobile/widgets/fade_in_cache_image.dart';
import '../../../constants/enum.dart';
class InventoryInoutCard extends StatelessWidget { class InventoryInoutCard extends StatelessWidget {
InventoryInoutCard({required this.index, required this.ind}); InventoryInoutCard({required this.index, required this.ind});
final int index; final int index;
@ -16,161 +16,253 @@ class InventoryInoutCard extends StatelessWidget {
final controller = Get.find<InventoryInoutController>(); final controller = Get.find<InventoryInoutController>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Dismissible( return Container(
key: UniqueKey(), margin: EdgeInsets.symmetric(
confirmDismiss: (direction) async { vertical: ScreenAdaper.height(15),
// return await ModalUtil.showWarningDialog( horizontal: ScreenAdaper.width(15)),
// 'Remove Task', 'Are you sure to remove this task', 'Confirm', () { padding: EdgeInsets.symmetric(
// controller.db.delete(controller.list[ind][index].key, 'Tasks'); horizontal: ScreenAdaper.width(defaultPadding),
// controller.list[ind].remove(controller.list[ind][index]); vertical: ScreenAdaper.height(defaultPadding)),
// }); decoration: BoxDecoration(
}, boxShadow: [
child: Container( BoxShadow(
margin: EdgeInsets.symmetric( color: AppTheme.barrierColor.withOpacity(0.2),
vertical: ScreenAdaper.height(15), offset: Offset(0, ScreenAdaper.height(5)),
horizontal: ScreenAdaper.width(15)), blurRadius: ScreenAdaper.sp(10)),
padding: EdgeInsets.symmetric( ],
horizontal: ScreenAdaper.width(defaultPadding)), color: AppTheme.nearlyWhite,
decoration: BoxDecoration( borderRadius: BorderRadius.circular(ScreenAdaper.sp(30))),
boxShadow: [ child: Row(
BoxShadow( crossAxisAlignment: CrossAxisAlignment.center,
color: lightAccentBlue.withOpacity(.5), children: [
offset: Offset(0, ScreenAdaper.height(5)), buildImage(),
blurRadius: ScreenAdaper.sp(10)), Expanded(child: buildContent()),
],
color: Colors.white, // const Spacer(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30))), // flex: 2,
child: Row( // ),
// controller.list[ind][index].inOrOut ==
// InventoryInOrOutEnumValues[InventoryInOrOutEnum.In]
// ? Container(
// height: ScreenAdaper.height(40),
// width: ScreenAdaper.width(40),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// gradient: const LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// colors: [
// lightOrange,
// darkOrange,
// ]),
// boxShadow: [
// BoxShadow(
// color: lightOrange,
// offset: Offset(0, ScreenAdaper.height(10)),
// blurRadius: ScreenAdaper.sp(10))
// ]),
// child: const Icon(
// Icons.done,
// color: Colors.white,
// ),
// )
// : Align(
// alignment: Alignment.topRight,
// child: Padding(
// padding: EdgeInsets.only(top: ScreenAdaper.height(20)),
// child: PopupMenuButton(
// onSelected: (value) => {
// // controller.onTaskComplete(value, index, ind,
// // controller.list[ind][index].key, context)
// },
// surfaceTintColor: Colors.white,
// padding: EdgeInsets.zero,
// icon: Icon(
// Icons.more_vert_rounded,
// color: Colors.grey,
// size: ScreenAdaper.sp(24),
// ),
// shape: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(ScreenAdaper.sp(20)),
// borderSide: BorderSide.none,
// ),
// itemBuilder: (context) {
// return [
// PopupMenuItem(
// height: ScreenAdaper.height(20),
// value: 1,
// child: Row(
// children: [
// Icon(
// Icons.edit_note,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// const Text('Edit')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 2,
// child: Row(
// children: [
// Icon(
// Icons.delete_outline,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Delete')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 3,
// child: Row(
// children: [
// Icon(
// Icons.done_all_outlined,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Complete')
// ],
// )),
// ];
// },
// )),
// ),
],
),
);
}
Widget buildContent() {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
// Image.asset( Expanded(
// Data().images[controller.list[ind][index].image], child: Text(
// height: 100, controller.list[ind][index].product?.name ?? '-',
// width: 100, overflow: TextOverflow.ellipsis,
// ), style: TextStyle(
if (controller.list[ind][index].files.isNotEmpty) color: Colors.black,
ClipRRect( fontWeight: FontWeight.bold,
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)), fontSize: ScreenAdaper.sp(25)),
child: FadeInCacheImage( )),
width: ScreenAdaper.width(100), buildInOrOut()
height: ScreenAdaper.width(100),
url:
'${GloablConfig.OSS_URL}${controller.list[ind][index].files[0]?.path}'),
),
SizedBox(
width: ScreenAdaper.width(defaultPadding) / 2,
),
InventoryInoutCardContent(index: index, ind: ind),
// const Spacer(
// flex: 2,
// ),
// controller.list[ind][index].inOrOut ==
// InventoryInOrOutEnumValues[InventoryInOrOutEnum.In]
// ? Container(
// height: ScreenAdaper.height(40),
// width: ScreenAdaper.width(40),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// gradient: const LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// colors: [
// lightOrange,
// darkOrange,
// ]),
// boxShadow: [
// BoxShadow(
// color: lightOrange,
// offset: Offset(0, ScreenAdaper.height(10)),
// blurRadius: ScreenAdaper.sp(10))
// ]),
// child: const Icon(
// Icons.done,
// color: Colors.white,
// ),
// )
// : Align(
// alignment: Alignment.topRight,
// child: Padding(
// padding: EdgeInsets.only(top: ScreenAdaper.height(20)),
// child: PopupMenuButton(
// onSelected: (value) => {
// // controller.onTaskComplete(value, index, ind,
// // controller.list[ind][index].key, context)
// },
// surfaceTintColor: Colors.white,
// padding: EdgeInsets.zero,
// icon: Icon(
// Icons.more_vert_rounded,
// color: Colors.grey,
// size: ScreenAdaper.sp(24),
// ),
// shape: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(ScreenAdaper.sp(20)),
// borderSide: BorderSide.none,
// ),
// itemBuilder: (context) {
// return [
// PopupMenuItem(
// height: ScreenAdaper.height(20),
// value: 1,
// child: Row(
// children: [
// Icon(
// Icons.edit_note,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// const Text('Edit')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 2,
// child: Row(
// children: [
// Icon(
// Icons.delete_outline,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Delete')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 3,
// child: Row(
// children: [
// Icon(
// Icons.done_all_outlined,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Complete')
// ],
// )),
// ];
// },
// )),
// ),
], ],
), ),
Text(
controller.list[ind][index].product?.company?.name ?? '-',
style: TextStyle(
color: AppTheme.grey,
fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(20)),
),
SizedBox(
height: ScreenAdaper.height(5),
),
Row(
children: [
Expanded(
child: Text(
'项目: ${controller.list[ind][index].project?.name}',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)),
),
),
],
),
SizedBox(
height: ScreenAdaper.height(5),
),
Row(
children: [
Expanded(
child: Text(
'数量: ${controller.list[ind][index].quantity} ${controller.list[ind][index].product?.unit?.label ?? '-'}',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)),
),
),
Text(
controller.list[ind][index].agent ?? '-',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: ScreenAdaper.sp(20)),
),
],
)
],
);
}
Widget buildImage() {
return Container(
margin: EdgeInsets.only(right: ScreenAdaper.width(defaultPadding) / 2),
child: ClipRRect(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
child: FadeInCacheImage(
width: ScreenAdaper.width(100),
height: ScreenAdaper.width(100),
url: controller.list[ind][index].product?.files.isNotEmpty ??
false
? '${GloablConfig.OSS_URL}${controller.list[ind][index].product?.files[0].path}'
: ''),
));
}
Widget buildInOrOut() {
final bgColor = controller.list[ind][index].inOrOut ==
InventoryInOrOutEnumValues[InventoryInOrOutEnum.In]
? AppTheme.snackbarSuccessBackgroudColor
: AppTheme.snackbarErrorBackgroudColor;
final textInOut = controller.list[ind][index].inOrOut ==
InventoryInOrOutEnumValues[InventoryInOrOutEnum.In]
? ''
: '';
return Container(
alignment: Alignment.center,
height: ScreenAdaper.height(40),
width: ScreenAdaper.width(40),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
bgColor.withOpacity(0.6),
bgColor,
]),
boxShadow: [
BoxShadow(
color: lightOrange,
offset: Offset(0, ScreenAdaper.height(10)),
blurRadius: ScreenAdaper.sp(10))
]),
child: Text(
textInOut,
style: const TextStyle(
color: AppTheme.nearlyWhite, fontWeight: FontWeight.w600),
), ),
); );
} }

View File

@ -1,72 +0,0 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class InventoryInoutCardContent extends StatelessWidget {
InventoryInoutCardContent(
{super.key, required this.index, required this.ind});
final int index;
final int ind;
final int randomColor1 = Random().nextInt(9);
final int randomColor2 = Random().nextInt(9);
final controller = Get.find<InventoryInoutController>();
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
controller.list[ind][index].product?.name ?? 'Product Name',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25)),
),
// Text(
// '${controller.list[ind][index].time} - ${controller.list[ind][index].time}',
// style: const TextStyle(
// color: Colors.grey, fontWeight: FontWeight.w300, fontSize: 12),
// ),
SizedBox(
height: ScreenAdaper.width(defaultPadding) / 2,
),
// Row(
// children: [
// Container(
// alignment: Alignment.center,
// padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
// decoration: BoxDecoration(
// color: Data().colors[randomColor1].withOpacity(.5),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// Data().tags[Random().nextInt(13)],
// style: TextStyle(color: Data().colors[randomColor1]),
// ),
// ),
// const SizedBox(
// width: defaultPadding / 2,
// ),
// Container(
// alignment: Alignment.center,
// padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
// decoration: BoxDecoration(
// color: Data().colors[randomColor2].withOpacity(.5),
// borderRadius: BorderRadius.circular(10)),
// child: Text(
// Data().tags[Random().nextInt(13)],
// style: TextStyle(color: Data().colors[randomColor2]),
// ),
// )
// ],
// ),
],
);
}
}

View File

@ -15,12 +15,12 @@ class TaskList extends StatelessWidget {
return Responsive( return Responsive(
tablet: Grid( tablet: Grid(
crossAsis: 2, crossAsis: 2,
ratio: 3, ratio: 2.2,
ind: index, ind: index,
), ),
largeTablet: Grid( largeTablet: Grid(
crossAsis: 3, crossAsis: 3,
ratio: 3, ratio: 2.3,
ind: index, ind: index,
), ),
mobile: Grid( mobile: Grid(

View File

@ -9,7 +9,8 @@ class TaskPageView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PageView( return PageView(
physics: const NeverScrollableScrollPhysics(), physics: const BouncingScrollPhysics(),
reverse: true,
controller: controller.pageController, controller: controller.pageController,
children: List.generate( children: List.generate(
controller.daysNum, controller.daysNum,

View File

@ -59,7 +59,8 @@ class InventoryInoutController extends GetxController {
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
left: value * 80, left: value * 80,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30)), borderRadius:
const BorderRadius.all(Radius.circular(30)),
child: Material( child: Material(
child: Ink( child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -67,7 +68,7 @@ class InventoryInoutController extends GetxController {
colors: [Colors.green[300]!, Colors.green], colors: [Colors.green[300]!, Colors.green],
), ),
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(30)), const BorderRadius.all(Radius.circular(30)),
), ),
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
@ -80,7 +81,7 @@ class InventoryInoutController extends GetxController {
shadowColor: MaterialStateProperty.all( shadowColor: MaterialStateProperty.all(
Colors.transparent), Colors.transparent),
shape: MaterialStateProperty.all( shape: MaterialStateProperty.all(
RoundedRectangleBorder( const RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(30)), BorderRadius.all(Radius.circular(30)),
), ),
@ -256,12 +257,12 @@ class InventoryInoutController extends GetxController {
} }
getDateAccordingTabs(int value) { getDateAccordingTabs(int value) {
return '${DateUtil.addPrefix(dateTime.add(Duration(days: value)).year.toString())}-${DateUtil.addPrefix(dateTime.add(Duration(days: value)).month.toString())}-${DateUtil.addPrefix(dateTime.add(Duration(days: value)).day.toString())}'; return DateUtil.format(dateTime.add(Duration(days: -(daysNum - value))));
} }
getSepretLists() { getSepretLists() {
List<RxList<InventoryInOutModel>> tempList = []; List<RxList<InventoryInOutModel>> tempList = [];
for (int i = 0; i < 7; i++) { for (int i = daysNum; i > 0; i--) {
RxList<InventoryInOutModel> tempList1 = <InventoryInOutModel>[].obs; RxList<InventoryInOutModel> tempList1 = <InventoryInOutModel>[].obs;
tempList1.clear(); tempList1.clear();
for (int j = 0; j < model.length; j++) { for (int j = 0; j < model.length; j++) {

View File

@ -115,7 +115,7 @@ class AuthStore extends GetxController {
try { try {
final response = await Api.getUserInfo(); final response = await Api.getUserInfo();
if (response.data != null) { if (response.data != null) {
UserInfoModel userInfo = UserInfoModel.fromJson(response.data['data']); UserInfoModel userInfo = UserInfoModel.fromJson(response.data);
await updateUserInfoState(userInfo); await updateUserInfoState(userInfo);
} }
} catch (e) { } catch (e) {

View File

@ -1,6 +1,8 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class FadeInCacheImage extends StatefulWidget { class FadeInCacheImage extends StatefulWidget {
final double? width; final double? width;
@ -40,13 +42,12 @@ class _FadeInCacheImageState extends State<FadeInCacheImage> {
theContext = context; theContext = context;
if ((widget.url == null || widget.url == '' || widget.url == 'null')) { if ((widget.url == null || widget.url == '' || widget.url == 'null')) {
return Image( return Container(
width: widget.width, width: widget.width,
height: widget.height, height: widget.height,
fit: widget.fit, child: Icon(Icons.image_not_supported,
image: AssetImage( size: ScreenAdaper.sp(100), color: AppTheme.grey),
'assets/images/deer_detail_banner1.jpg', );
));
} }
return buildImg(widget.url); return buildImg(widget.url);