feat: 首页UI
This commit is contained in:
parent
d1aaecd800
commit
d1a691444c
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
@ -5,12 +5,12 @@ class AppTheme {
|
|||
AppTheme._();
|
||||
static const Color primaryColor = Color(0xFFC89607);
|
||||
static const Color primaryColorLight = Color.fromARGB(255, 255, 206, 70);
|
||||
static Color primaryColorDark = Color.fromRGBO(
|
||||
primaryColor.red,
|
||||
primaryColor.green,
|
||||
primaryColor.blue,
|
||||
1 - primaryColor.computeLuminance(),
|
||||
);
|
||||
static const Color primaryColorDark = Color.fromARGB(255, 163, 120, 0);
|
||||
|
||||
static const Color secondPrimaryColor = Color(0xFFc12a3a);
|
||||
static const Color secondPrimaryColorLight = Color.fromARGB(255, 230, 79, 94);
|
||||
static const Color secondPrimaryColorDark = Color.fromARGB(255, 141, 12, 25);
|
||||
|
||||
static const Color white = Color(0xFFFFFFFF);
|
||||
static const Color nearlyWhite = Color(0xFFFEFEFE);
|
||||
static const Color black = Color(0xFF000000);
|
||||
|
|
|
@ -5,3 +5,4 @@ export 'enum.dart';
|
|||
export 'global_url.dart';
|
||||
export 'cache_key.dart';
|
||||
export 'router.dart';
|
||||
export 'text_enum.dart';
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class TextEnum {
|
||||
static const String noInventoryInout = "今天没有出入库记录";
|
||||
static const String homeWelcomeText = '你好,';
|
||||
static const String backToTodayButtonText = '今天';
|
||||
}
|
|
@ -4,6 +4,7 @@ import 'package:sk_base_mobile/constants/bg_color.dart';
|
|||
import 'package:sk_base_mobile/screens/home/components/change_icon.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/today_button.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||
|
||||
class ChangeButtonRow extends StatelessWidget {
|
||||
ChangeButtonRow({super.key});
|
||||
|
@ -15,18 +16,18 @@ class ChangeButtonRow extends StatelessWidget {
|
|||
horizontal: MediaQuery.sizeOf(context).width * 0.06),
|
||||
child: Row(
|
||||
children: [
|
||||
TodayButton(),
|
||||
Spacer(),
|
||||
const TodayButton(),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () => controller.onMoveBack(),
|
||||
child: ChangeIconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios_rounded,
|
||||
color: Colors.white,
|
||||
size: 15,
|
||||
size: ScreenAdaper.sp(30),
|
||||
))),
|
||||
SizedBox(
|
||||
width: defaultPadding / 2,
|
||||
const SizedBox(
|
||||
width: defaultPadding,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => controller.onMoveNextPage(),
|
||||
|
@ -34,7 +35,7 @@ class ChangeButtonRow extends StatelessWidget {
|
|||
icon: Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
color: Colors.white,
|
||||
size: 15,
|
||||
size: ScreenAdaper.sp(30),
|
||||
))),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||
|
||||
class ChangeIconButton extends StatelessWidget {
|
||||
const ChangeIconButton({super.key, required this.icon});
|
||||
|
@ -7,15 +8,15 @@ class ChangeIconButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
height: ScreenAdaper.height(60),
|
||||
width: ScreenAdaper.height(60),
|
||||
alignment: Alignment.center,
|
||||
decoration:
|
||||
BoxDecoration(shape: BoxShape.circle, color: neviBlue, boxShadow: [
|
||||
BoxShadow(
|
||||
color: neviBlue.withOpacity(.3),
|
||||
offset: Offset(0, 10),
|
||||
blurRadius: 10)
|
||||
offset: Offset(0, ScreenAdaper.height(10)),
|
||||
blurRadius: ScreenAdaper.sp(10))
|
||||
]),
|
||||
child: icon,
|
||||
);
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/app_theme.dart';
|
||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||
import 'package:sk_base_mobile/constants/constants.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/store/auth.store.dart';
|
||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||
|
||||
class CustomAppBar extends StatelessWidget {
|
||||
|
@ -10,31 +13,31 @@ class CustomAppBar extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
padding: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(30)),
|
||||
child: Row(
|
||||
children: [
|
||||
if (ScreenAdaper.isLandspace()) Spacer(),
|
||||
if (ScreenAdaper.isLandspace()) const Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Hello,',
|
||||
TextEnum.homeWelcomeText,
|
||||
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 0,
|
||||
letterSpacing: 2,
|
||||
fontSize: 18),
|
||||
fontSize: ScreenAdaper.sp(25)),
|
||||
),
|
||||
Obx(
|
||||
() => Text(
|
||||
controller.name.value,
|
||||
AuthStore.to.userInfo.value.username ?? '',
|
||||
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 2,
|
||||
height: 0,
|
||||
fontSize: 25),
|
||||
fontSize: ScreenAdaper.sp(30)),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
@ -43,19 +46,20 @@ class CustomAppBar extends StatelessWidget {
|
|||
flex: 10,
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
width: 50,
|
||||
height: ScreenAdaper.height(70),
|
||||
width: ScreenAdaper.width(70),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: darkAccentBlue,
|
||||
boxShadow: const [
|
||||
color: AppTheme.primaryColorLight,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: lightAccentBlue,
|
||||
blurRadius: 20,
|
||||
offset: Offset(0, 10))
|
||||
color: AppTheme.primaryColor,
|
||||
blurRadius: ScreenAdaper.sp(20),
|
||||
offset: Offset(0, ScreenAdaper.height(10)))
|
||||
]),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.account_circle_outlined,
|
||||
size: ScreenAdaper.sp(40),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/app_theme.dart';
|
||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||
import 'dates.dart';
|
||||
|
||||
class DateContainer extends StatelessWidget {
|
||||
|
@ -10,29 +12,34 @@ class DateContainer extends StatelessWidget {
|
|||
final controller = Get.put(HomeController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var size = MediaQuery.sizeOf(context);
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
return Obx(() => AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
height: 110,
|
||||
width: 70,
|
||||
margin: EdgeInsets.only(left: size.width * 0.05),
|
||||
height: ScreenAdaper.height(120),
|
||||
width: ScreenAdaper.width(100),
|
||||
margin: EdgeInsets.only(left: ScreenAdaper.width(size.width) * 0.05),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)),
|
||||
gradient: controller.currentIndex.value == index
|
||||
? const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [lightOrange, darkOrange])
|
||||
colors: [
|
||||
AppTheme.secondPrimaryColor,
|
||||
AppTheme.secondPrimaryColorDark
|
||||
])
|
||||
: null,
|
||||
boxShadow: [
|
||||
controller.currentIndex.value == index
|
||||
? const BoxShadow(
|
||||
color: lightOrange, offset: Offset(0, 10), blurRadius: 20)
|
||||
: const BoxShadow(
|
||||
? BoxShadow(
|
||||
color: AppTheme.secondPrimaryColorLight,
|
||||
offset: Offset(0, ScreenAdaper.width(10)),
|
||||
blurRadius: ScreenAdaper.sp(20))
|
||||
: BoxShadow(
|
||||
color: Colors.black12,
|
||||
offset: Offset(0, 10),
|
||||
blurRadius: 20)
|
||||
offset: Offset(0, ScreenAdaper.width(10)),
|
||||
blurRadius: ScreenAdaper.sp(20))
|
||||
]),
|
||||
child: Dates(index: index)));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class Dates extends StatelessWidget {
|
|||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
fontSize: ScreenAdaper.sp(16),
|
||||
height: 0),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/app_theme.dart';
|
||||
import 'package:sk_base_mobile/constants/constants.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/responsive.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/task_detail_container.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/util/util.dart';
|
||||
|
||||
class TaskList extends StatelessWidget {
|
||||
const TaskList({super.key, required this.index});
|
||||
|
@ -41,11 +44,14 @@ class Grid extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() => controller.list[ind].isEmpty
|
||||
? const Center(
|
||||
? Center(
|
||||
child: Text(
|
||||
'No Task Today',
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
|
||||
TextEnum.noInventoryInout,
|
||||
style: TextStyle(
|
||||
color: AppTheme.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: ScreenAdaper.width(2),
|
||||
fontSize: ScreenAdaper.sp(30)),
|
||||
),
|
||||
)
|
||||
: GridView.builder(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/change_button_roe.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/task_page_View.dart';
|
||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||
|
||||
class TaskPageBody extends StatelessWidget {
|
||||
const TaskPageBody({super.key});
|
||||
|
@ -10,10 +11,11 @@ class TaskPageBody extends StatelessWidget {
|
|||
children: [
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 25),
|
||||
margin: EdgeInsets.only(top: ScreenAdaper.height(25)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(40), topLeft: Radius.circular(40)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(ScreenAdaper.sp(40)),
|
||||
topLeft: Radius.circular(ScreenAdaper.sp(40))),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||
import 'package:sk_base_mobile/app_theme.dart';
|
||||
import 'package:sk_base_mobile/constants/constants.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/util/util.dart';
|
||||
|
||||
class TodayButton extends StatelessWidget {
|
||||
const TodayButton({super.key});
|
||||
|
@ -10,27 +12,30 @@ class TodayButton extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final controller = Get.put(HomeController());
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30)),
|
||||
onTap: () => controller.pageController.animateToPage(0,
|
||||
duration: Duration(milliseconds: 300), curve: Curves.easeIn),
|
||||
duration: const Duration(milliseconds: 300), curve: Curves.easeIn),
|
||||
child: Container(
|
||||
height: 50,
|
||||
width: 150,
|
||||
height: ScreenAdaper.height(70),
|
||||
width: ScreenAdaper.width(200),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
boxShadow: const [
|
||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: lightAccentBlue, offset: Offset(0, 5), blurRadius: 20)
|
||||
color: AppTheme.primaryColorLight,
|
||||
offset: Offset(0, ScreenAdaper.height(10)),
|
||||
blurRadius: ScreenAdaper.sp(25))
|
||||
],
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [lightAccentBlue, darkAccentBlue])),
|
||||
child: const Text(
|
||||
'Today',
|
||||
colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])),
|
||||
child: Text(
|
||||
TextEnum.backToTodayButtonText,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: ScreenAdaper.sp(25),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:sk_base_mobile/constants/bg_color.dart';
|
|||
import 'package:sk_base_mobile/screens/home/components/custom_app_bar.dart';
|
||||
import 'package:sk_base_mobile/screens/home/components/date_container.dart';
|
||||
import 'package:sk_base_mobile/screens/home/home_controller.dart';
|
||||
import 'package:sk_base_mobile/util/util.dart';
|
||||
|
||||
class UperBody extends StatelessWidget {
|
||||
UperBody({super.key});
|
||||
|
@ -17,16 +18,17 @@ class UperBody extends StatelessWidget {
|
|||
),
|
||||
CustomAppBar(),
|
||||
SizedBox(
|
||||
height: 150,
|
||||
height: ScreenAdaper.height(150),
|
||||
child: ListView.builder(
|
||||
controller: controller.scrollController,
|
||||
itemCount: 7,
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.only(bottom: 30, top: defaultPadding),
|
||||
padding: EdgeInsets.only(
|
||||
bottom: ScreenAdaper.height(30), top: defaultPadding),
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)),
|
||||
onTap: () => controller.setIndex(index),
|
||||
child: DateContainer(index: index),
|
||||
);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/constants/bg_color.dart';
|
||||
import 'package:sk_base_mobile/db_helper/dbHelper.dart';
|
||||
import 'package:sk_base_mobile/util/date.util.dart';
|
||||
import 'package:sk_base_mobile/util/modal.util.dart';
|
||||
|
||||
class HomeController extends GetxController {
|
||||
RxMap userData = {}.obs;
|
||||
RxString name = ''.obs;
|
||||
RxInt currentIndex = 0.obs;
|
||||
final PageController pageController = PageController();
|
||||
final DateTime dateTime = DateTime.now();
|
||||
|
@ -25,17 +24,7 @@ class HomeController extends GetxController {
|
|||
RxList model = [].obs;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
HomeController() {
|
||||
if (userData['NAME'] == null) {
|
||||
getUserData();
|
||||
}
|
||||
}
|
||||
|
||||
getUserData() async {
|
||||
getName();
|
||||
}
|
||||
|
||||
getName() {}
|
||||
HomeController() {}
|
||||
|
||||
getTasks() async {
|
||||
db.getData().then((value) {
|
||||
|
@ -50,20 +39,23 @@ class HomeController extends GetxController {
|
|||
currentIndex.value = value;
|
||||
}
|
||||
|
||||
getDateAccordingTabs(int value) {}
|
||||
getDateAccordingTabs(int value) {
|
||||
return '${DateUtil.addPrefix(dateTime.add(Duration(days: value)).day.toString())}/${DateUtil.addPrefix(dateTime.add(Duration(days: value)).month.toString())}/${DateUtil.addPrefix(dateTime.add(Duration(days: value)).year.toString())}';
|
||||
}
|
||||
|
||||
getSepretLists() {
|
||||
// List<RxList<dynamic>> tempList = [];
|
||||
// for (int i = 0; i < 7; i++) {
|
||||
// RxList tempList1 = [].obs;
|
||||
// tempList1.clear();
|
||||
// for (int j = 0; j < model.length; j++) {
|
||||
// if (model[j].date == getDateAccordingTabs(i)) {
|
||||
// tempList1.add(model[j]);
|
||||
// }
|
||||
// }
|
||||
// tempList.add(tempList1);
|
||||
// }
|
||||
// list = tempList;
|
||||
List<RxList<dynamic>> tempList = [];
|
||||
for (int i = 0; i < 7; i++) {
|
||||
RxList tempList1 = [].obs;
|
||||
tempList1.clear();
|
||||
for (int j = 0; j < model.length; j++) {
|
||||
if (model[j].date == getDateAccordingTabs(i)) {
|
||||
tempList1.add(model[j]);
|
||||
}
|
||||
}
|
||||
tempList.add(tempList1);
|
||||
}
|
||||
list = tempList;
|
||||
}
|
||||
|
||||
onMoveNextPage() {
|
||||
|
|
|
@ -1,28 +1,11 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sk_base_mobile/models/app_bottom_nav_item.dart';
|
||||
import 'package:sk_base_mobile/services/app_info.service.dart';
|
||||
|
||||
class LandingController extends GetxController {
|
||||
RxMap userData = {}.obs;
|
||||
RxString name = ''.obs;
|
||||
RxInt currentIndex = 0.obs;
|
||||
final PageController pageController = PageController();
|
||||
final DateTime dateTime = DateTime.now();
|
||||
|
||||
List<IconData> iconList = [Icons.home_max, Icons.person_outline_rounded];
|
||||
List<RxList> list = [
|
||||
[].obs,
|
||||
[].obs,
|
||||
[].obs,
|
||||
[].obs,
|
||||
[].obs,
|
||||
[].obs,
|
||||
[].obs,
|
||||
].obs;
|
||||
RxList model = [].obs;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
RxList bottomNavItems = RxList<BottomNavigationBarItem>([]);
|
||||
List<Widget> pages = [];
|
||||
|
||||
|
@ -37,83 +20,4 @@ class LandingController extends GetxController {
|
|||
.toList());
|
||||
pages = roleWithBottomNavItems.map((e) => e.page!).toList();
|
||||
}
|
||||
|
||||
getUserData() async {
|
||||
getName();
|
||||
}
|
||||
|
||||
getName() {
|
||||
// name.value = userData['NAME'];
|
||||
}
|
||||
|
||||
getTasks() async {
|
||||
// db.getData().then((value) {
|
||||
// model.value = value;
|
||||
// getSepretLists();
|
||||
// });
|
||||
}
|
||||
|
||||
setIndex(int value) {
|
||||
pageController.animateToPage(value,
|
||||
duration: const Duration(milliseconds: 300), curve: Curves.easeIn);
|
||||
currentIndex.value = value;
|
||||
}
|
||||
|
||||
// getDateAccordingTabs(int value) {
|
||||
// return '${Utils.addPrefix(dateTime.add(Duration(days: value)).day.toString())}/${Utils.addPrefix(dateTime.add(Duration(days: value)).month.toString())}/${Utils.addPrefix(dateTime.add(Duration(days: value)).year.toString())}';
|
||||
// }
|
||||
|
||||
getSepretLists() {
|
||||
// List<RxList<dynamic>> tempList = [];
|
||||
// for (int i = 0; i < 7; i++) {
|
||||
// RxList tempList1 = [].obs;
|
||||
// tempList1.clear();
|
||||
// for (int j = 0; j < model.length; j++) {
|
||||
// if (model[j].date == getDateAccordingTabs(i)) {
|
||||
// tempList1.add(model[j]);
|
||||
// }
|
||||
// }
|
||||
// tempList.add(tempList1);
|
||||
// }
|
||||
// list = tempList;
|
||||
}
|
||||
|
||||
onMoveNextPage() {
|
||||
if (currentIndex.value < 7) {
|
||||
setIndex(currentIndex.value + 1);
|
||||
}
|
||||
}
|
||||
|
||||
onMoveBack() {
|
||||
if (currentIndex.value > 0) {
|
||||
setIndex(currentIndex.value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
onTaskComplete(
|
||||
int value, int index, int ind, String key, BuildContext context) {
|
||||
// switch (value) {
|
||||
// case 3:
|
||||
// {
|
||||
// Utils.showWarningDialog(context, 'Complete Task',
|
||||
// 'This task will be marked as completed', 'Confirm', () {
|
||||
// list[ind][index].status = 'complete';
|
||||
// list[ind].add('');
|
||||
// list[ind].remove('');
|
||||
// db.update(key, 'status', 'complete');
|
||||
// });
|
||||
// }
|
||||
// case 2:
|
||||
// {
|
||||
// Utils.showWarningDialog(context, 'Delete Task',
|
||||
// 'Are you want to sure to remove', 'Confirm', () {
|
||||
// list[ind].remove(list[ind][index]);
|
||||
// db.delete(
|
||||
// key,
|
||||
// 'Tasks',
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,21 +23,12 @@ class AuthStore extends GetxController {
|
|||
String? token =
|
||||
StorageService.to.getString(CacheKeys.token, isWithUser: false);
|
||||
|
||||
// if (token != null) {
|
||||
// final response = await Api.isValidToken(token);
|
||||
// if (response.data != null) {
|
||||
// // Token有效无需登录
|
||||
// if (response.data['data'] == true) {
|
||||
// } else {
|
||||
// LoggerUtil().info('[Store-Auth] Token invalid, need to login.');
|
||||
// await StorageService.to.remove(CacheKeys.token, isWithUser: false);
|
||||
// }
|
||||
// if (preUserInfo != null) {
|
||||
// userInfo(UserInfoModel.fromJson(jsonDecode(preUserInfo)));
|
||||
// LoggerUtil().info('[Store-Auth] userId: ${userInfo.value.userId}');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (token != null) {
|
||||
if (preUserInfo != null) {
|
||||
userInfo(UserInfoModel.fromJson(jsonDecode(preUserInfo)));
|
||||
LoggerUtil().info('[Store-Auth] userId: ${userInfo.value.id}');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
LoggerUtil().info(
|
||||
'[Store-Auth]Init failed, please try again.${e}',
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import 'package:date_format/date_format.dart';
|
||||
|
||||
class DateUtil {
|
||||
/// 获取几月
|
||||
static String getMonth(DateTime date) {
|
||||
String formattedDate = formatDate(date, ['MMM']);
|
||||
String formattedDate = '${date.month}月';
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
/// 获取几号
|
||||
static String getDate(DateTime date) {
|
||||
String formattedDate = formatDate(date, ['d']);
|
||||
if (formattedDate.length == 1) {
|
||||
|
@ -14,9 +16,10 @@ class DateUtil {
|
|||
return formattedDate;
|
||||
}
|
||||
|
||||
/// 获取周几
|
||||
static String getDay(DateTime date) {
|
||||
String formattedDate = formatDate(date, ['EEE']);
|
||||
return formattedDate;
|
||||
List<String> daysOfWeekInChinese = ['一', '二', '三', '四', '五', '六', '日'];
|
||||
return '星期${daysOfWeekInChinese[date.weekday - 1]}';
|
||||
}
|
||||
|
||||
static String addPrefix(String string) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
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/util/screen_adaper_util.dart';
|
||||
|
||||
|
@ -8,17 +9,17 @@ class BackColors extends StatelessWidget {
|
|||
const BackColors({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var size = MediaQuery.sizeOf(context);
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
margin: EdgeInsets.only(top: ScreenAdaper.height(30)),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 100,
|
||||
top: ScreenAdaper.height(100),
|
||||
child: Container(
|
||||
height: size.height * 0.5,
|
||||
width: size.width * 0.5,
|
||||
height: ScreenAdaper.height(size.height) * 0.5,
|
||||
width: ScreenAdaper.width(size.width) * 0.5,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
gradient: LinearGradient(
|
||||
|
@ -38,11 +39,11 @@ class BackColors extends StatelessWidget {
|
|||
])),
|
||||
)),
|
||||
Positioned(
|
||||
top: 100,
|
||||
right: -50,
|
||||
top: ScreenAdaper.height(100),
|
||||
right: ScreenAdaper.width(-50),
|
||||
child: Container(
|
||||
height: size.height * 0.5,
|
||||
width: size.width * 0.3,
|
||||
height: ScreenAdaper.height(size.height) * 0.5,
|
||||
width: ScreenAdaper.width(size.width) * 0.3,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
gradient: LinearGradient(
|
||||
|
@ -59,11 +60,11 @@ class BackColors extends StatelessWidget {
|
|||
])),
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 100,
|
||||
right: -50,
|
||||
bottom: ScreenAdaper.height(100),
|
||||
right: ScreenAdaper.width(-50),
|
||||
child: Container(
|
||||
height: size.height * 0.5,
|
||||
width: size.width * 0.6,
|
||||
height: ScreenAdaper.height(size.height) * 0.5,
|
||||
width: ScreenAdaper.width(size.width) * 0.6,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
|
@ -83,10 +84,9 @@ class BackColors extends StatelessWidget {
|
|||
])),
|
||||
)),
|
||||
Positioned(
|
||||
bottom: -30,
|
||||
bottom: ScreenAdaper.height(-60),
|
||||
child: Container(
|
||||
height: size.height * 0.3,
|
||||
width: size.width * 0.6,
|
||||
height: ScreenAdaper.height(size.height) * 0.3,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
|
@ -108,7 +108,9 @@ class BackColors extends StatelessWidget {
|
|||
Positioned(
|
||||
bottom: 1,
|
||||
left: 1,
|
||||
top: !ScreenAdaper.isLandspace() ? 100 : 200,
|
||||
top: !ScreenAdaper.isLandspace()
|
||||
? ScreenAdaper.height(160)
|
||||
: ScreenAdaper.height(220),
|
||||
right: 1,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
|
@ -117,45 +119,37 @@ class BackColors extends StatelessWidget {
|
|||
begin: Alignment.topLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [
|
||||
Colors.pinkAccent.withOpacity(.0),
|
||||
Colors.pinkAccent.withOpacity(.1),
|
||||
Colors.pinkAccent.withOpacity(.2),
|
||||
Colors.pinkAccent.withOpacity(.3),
|
||||
Colors.pinkAccent.withOpacity(.4),
|
||||
Colors.pinkAccent.withOpacity(.4),
|
||||
Colors.pinkAccent.withOpacity(.3),
|
||||
Colors.pinkAccent.withOpacity(.2),
|
||||
Colors.pinkAccent.withOpacity(.1),
|
||||
Colors.pinkAccent.withOpacity(0),
|
||||
for (var i = 0; i <= 4; i += 1)
|
||||
AppTheme.primaryColorLight.withOpacity(i * 0.1),
|
||||
for (var i = 4; i >= 0; i -= 1)
|
||||
AppTheme.primaryColorLight.withOpacity(i * 0.1),
|
||||
])),
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 1,
|
||||
right: 1,
|
||||
child: Container(
|
||||
height: size.height * 0.3,
|
||||
width: size.width * 0.6,
|
||||
height: ScreenAdaper.height(size.height) * 0.3,
|
||||
width: ScreenAdaper.width(size.width) * 0.6,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [
|
||||
Colors.greenAccent.withOpacity(.0),
|
||||
Colors.greenAccent.withOpacity(.1),
|
||||
Colors.greenAccent.withOpacity(.2),
|
||||
Colors.greenAccent.withOpacity(.3),
|
||||
Colors.greenAccent.withOpacity(.4),
|
||||
Colors.greenAccent.withOpacity(.4),
|
||||
Colors.greenAccent.withOpacity(.3),
|
||||
Colors.greenAccent.withOpacity(.2),
|
||||
Colors.greenAccent.withOpacity(.1),
|
||||
Colors.greenAccent.withOpacity(0),
|
||||
for (var i = 0; i <= 4; i += 1)
|
||||
AppTheme.secondPrimaryColorLight
|
||||
.withOpacity(i * 0.1),
|
||||
for (var i = 4; i >= 0; i -= 1)
|
||||
AppTheme.secondPrimaryColorLight
|
||||
.withOpacity(i * 0.1),
|
||||
])),
|
||||
)),
|
||||
Positioned.fill(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaY: 30, sigmaX: 30),
|
||||
filter: ImageFilter.blur(
|
||||
sigmaY: ScreenAdaper.height(30),
|
||||
sigmaX: ScreenAdaper.width(30)),
|
||||
child: SizedBox(),
|
||||
)),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue