|
|
@@ -10,6 +10,7 @@ import 'package:electronic_assistant/resource/colors.gen.dart';
|
|
|
import 'package:electronic_assistant/resource/string.gen.dart';
|
|
|
import 'package:electronic_assistant/utils/expand.dart';
|
|
|
import 'package:electronic_assistant/widget/pull_to_refresh.dart';
|
|
|
+import 'package:flutter/gestures.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
@@ -17,6 +18,7 @@ import 'package:get/get.dart';
|
|
|
|
|
|
import '../../data/bean/agenda.dart';
|
|
|
import '../../router/app_pages.dart';
|
|
|
+import '../../utils/toast_util.dart';
|
|
|
import '../talk/view.dart';
|
|
|
import '../task/task_item_view.dart';
|
|
|
import 'controller.dart';
|
|
|
@@ -29,7 +31,6 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
return Stack(
|
|
|
children: [
|
|
|
buildBgBox(),
|
|
|
- buildTopGradient(),
|
|
|
SafeArea(
|
|
|
child: Column(
|
|
|
children: [
|
|
|
@@ -39,32 +40,46 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
child: buildOperationBar(),
|
|
|
),
|
|
|
Expanded(
|
|
|
- child: PullToRefresh(
|
|
|
- enableRefresh: true,
|
|
|
- controller: controller.refreshController,
|
|
|
- onRefresh: () {
|
|
|
- controller.requestHomeData();
|
|
|
- },
|
|
|
- child: CustomScrollView(
|
|
|
- slivers: [
|
|
|
- buildTalkRecordTitle(),
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: Container(
|
|
|
- height: 0.3111.sw,
|
|
|
- margin: EdgeInsets.only(bottom: 15.h),
|
|
|
- child: buildTalkRecord(),
|
|
|
+ child: Container(
|
|
|
+ color: "#F6F5F8".toColor(),
|
|
|
+ child: PullToRefresh(
|
|
|
+ enableRefresh: true,
|
|
|
+ controller: controller.refreshController,
|
|
|
+ onRefresh: () {
|
|
|
+ controller.requestHomeData();
|
|
|
+ },
|
|
|
+ child: CustomScrollView(
|
|
|
+ slivers: [
|
|
|
+ buildHeaderView(),
|
|
|
+ buildTalkRecordTitle(),
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter,
|
|
|
+ colors: [
|
|
|
+ "#FEFEFE".toColor(),
|
|
|
+ "#FCFBFC".toColor()
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ height: 0.3472222.sw,
|
|
|
+ padding: EdgeInsets.only(bottom: 15.h),
|
|
|
+ child: buildTalkRecord(),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- buildTalkTodoTitle(),
|
|
|
- Obx(() {
|
|
|
- return SliverList.builder(
|
|
|
- itemBuilder: _builderAgendaItem,
|
|
|
- itemCount: controller.agendaList.length >= 10
|
|
|
- ? 10
|
|
|
- : controller.agendaList.length);
|
|
|
- }),
|
|
|
- buildSeeMoreView(),
|
|
|
- ],
|
|
|
+ buildTalkTodoTitle(),
|
|
|
+ Obx(() {
|
|
|
+ return SliverList.builder(
|
|
|
+ itemBuilder: _builderAgendaItem,
|
|
|
+ itemCount: controller.agendaList.length >= 10
|
|
|
+ ? 10
|
|
|
+ : controller.agendaList.length);
|
|
|
+ }),
|
|
|
+ buildSeeMoreView(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
))
|
|
|
],
|
|
|
@@ -79,58 +94,172 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- SliverToBoxAdapter buildSeeMoreView() {
|
|
|
+ Widget buildHeaderView() {
|
|
|
return SliverToBoxAdapter(
|
|
|
child: Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- padding: const EdgeInsets.only(top: 12, bottom: 36).w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter,
|
|
|
+ colors: [ColorName.white, "#EEEFFB".toColor()],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ padding:
|
|
|
+ EdgeInsets.only(left: 12.w, right: 12.w, top: 8.h, bottom: 16.h),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: _buildHeaderCard(
|
|
|
+ StringName.homeTalkAudio.tr,
|
|
|
+ StringName.homeTalkQuickAudio.tr,
|
|
|
+ Assets.images.iconHomeTalkRecordCard.image().image, [
|
|
|
+ "#1763F9".toColor(),
|
|
|
+ "#28B2FF".toColor(),
|
|
|
+ ], onTap: () {
|
|
|
+ Get.toNamed(RoutePath.record);
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Expanded(
|
|
|
+ child: _buildHeaderCard(
|
|
|
+ StringName.homeTalkImportAudio.tr,
|
|
|
+ StringName.homeTalkAnalyzeLocalAudio.tr,
|
|
|
+ Assets.images.iconHomeTalkSelectCard.image().image,
|
|
|
+ [
|
|
|
+ "#5869ED".toColor(),
|
|
|
+ "#6E8AF7".toColor(),
|
|
|
+ ],
|
|
|
+ onTap: () {}),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- // child: RichText(
|
|
|
- // text: TextSpan(
|
|
|
- // text: StringName.homeTalkTodo1.tr,
|
|
|
- // style:
|
|
|
- // TextStyle(color: ColorName.secondaryTextColor, fontSize: 12.sp),
|
|
|
- // children: <TextSpan>[
|
|
|
- // TextSpan(
|
|
|
- // text: StringName.homeTalkTodo2.tr,
|
|
|
- // style:
|
|
|
- // TextStyle(color: ColorName.colorPrimary, fontSize: 12.sp),
|
|
|
- // recognizer: TapGestureRecognizer()
|
|
|
- // ..onTap = () {
|
|
|
- // ToastUtil.showToast('点击了全部');
|
|
|
- // }),
|
|
|
- // ],
|
|
|
- // ),
|
|
|
- // ),
|
|
|
+ Widget _buildHeaderCard(
|
|
|
+ String title,
|
|
|
+ String content,
|
|
|
+ ImageProvider imageProvider,
|
|
|
+ List<Color> bgColor, {
|
|
|
+ VoidCallback? onTap,
|
|
|
+ }) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: onTap,
|
|
|
+ child: AspectRatio(
|
|
|
+ aspectRatio: 164 / 80,
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topLeft,
|
|
|
+ end: Alignment.bottomRight,
|
|
|
+ colors: bgColor,
|
|
|
+ ),
|
|
|
+ borderRadius: BorderRadius.circular(12),
|
|
|
+ ),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.centerRight,
|
|
|
+ child: AspectRatio(
|
|
|
+ aspectRatio: 1,
|
|
|
+ child: SizedBox(
|
|
|
+ height: double.infinity,
|
|
|
+ child: Image(image: imageProvider)),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ child: IntrinsicHeight(
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.only(left: 12.w),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(title,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp,
|
|
|
+ color: ColorName.white,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(height: 4.h),
|
|
|
+ Text(content,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.white80)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- SliverToBoxAdapter buildTalkTodoTitle() {
|
|
|
+ SliverToBoxAdapter buildSeeMoreView() {
|
|
|
return SliverToBoxAdapter(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- SizedBox(height: 9.w),
|
|
|
- // buildTitle(StringName.homeTalkTodoTitle.tr, () {
|
|
|
- // Get.toNamed(RoutePath.task);
|
|
|
- // }),
|
|
|
- buildTitle(StringName.homeTalkTodoTitle.tr, null),
|
|
|
- SizedBox(height: 12.w)
|
|
|
- ],
|
|
|
- ));
|
|
|
+ child: Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ padding: const EdgeInsets.only(top: 12, bottom: 36).w,
|
|
|
+ child: RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ text: StringName.homeTalkTodo1.tr,
|
|
|
+ style:
|
|
|
+ TextStyle(color: ColorName.secondaryTextColor, fontSize: 12.sp),
|
|
|
+ children: <TextSpan>[
|
|
|
+ TextSpan(
|
|
|
+ text: StringName.homeTalkTodo2.tr,
|
|
|
+ style:
|
|
|
+ TextStyle(color: ColorName.colorPrimary, fontSize: 12.sp),
|
|
|
+ recognizer: TapGestureRecognizer()
|
|
|
+ ..onTap = () {
|
|
|
+ ToastUtil.showToast('点击了全部');
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- SliverToBoxAdapter buildTalkRecordTitle() {
|
|
|
+ SliverToBoxAdapter buildTalkTodoTitle() {
|
|
|
return SliverToBoxAdapter(
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter,
|
|
|
+ colors: ["#FCFBFC".toColor(), "#F6F5F8".toColor()],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
child: Column(
|
|
|
children: [
|
|
|
- SizedBox(height: 7.w),
|
|
|
- buildTitle(StringName.homeTalkRecord.tr, () {
|
|
|
- controller.goTalkRecordPage();
|
|
|
+ SizedBox(height: 12.w),
|
|
|
+ buildTitle(StringName.homeTalkTodoTitle.tr, () {
|
|
|
+ Get.toNamed(RoutePath.task);
|
|
|
}),
|
|
|
SizedBox(height: 12.w)
|
|
|
],
|
|
|
),
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ SliverToBoxAdapter buildTalkRecordTitle() {
|
|
|
+ return SliverToBoxAdapter(
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter,
|
|
|
+ colors: [ColorName.white, "#FEFEFE".toColor()],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 12).w,
|
|
|
+ child: buildTitle(StringName.homeTalkRecord.tr, () {
|
|
|
+ controller.goTalkRecordPage();
|
|
|
+ }),
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -209,24 +338,24 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- Container buildTopGradient() {
|
|
|
- return Container(
|
|
|
- width: 1.sw,
|
|
|
- height: 112.h,
|
|
|
- decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(
|
|
|
- colors: ['#E8EBFF'.toColor(), '#00E8EBFF'.toColor()],
|
|
|
- begin: Alignment.topCenter,
|
|
|
- end: Alignment.bottomCenter,
|
|
|
- stops: const [0.3, 1.0],
|
|
|
- ),
|
|
|
- ) // 其他子小部件
|
|
|
- );
|
|
|
- }
|
|
|
+ // Container buildTopGradient() {
|
|
|
+ // return Container(
|
|
|
+ // width: 1.sw,
|
|
|
+ // height: 112.h,
|
|
|
+ // decoration: BoxDecoration(
|
|
|
+ // gradient: LinearGradient(
|
|
|
+ // colors: ['#E8EBFF'.toColor(), '#00E8EBFF'.toColor()],
|
|
|
+ // begin: Alignment.topCenter,
|
|
|
+ // end: Alignment.bottomCenter,
|
|
|
+ // stops: const [0.3, 1.0],
|
|
|
+ // ),
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+ // }
|
|
|
|
|
|
DecoratedBox buildBgBox() {
|
|
|
return DecoratedBox(
|
|
|
- decoration: BoxDecoration(color: '#F6F6F6'.toColor()),
|
|
|
+ decoration: const BoxDecoration(color: ColorName.white),
|
|
|
child: Container(
|
|
|
height: double.infinity,
|
|
|
));
|
|
|
@@ -239,7 +368,6 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
slivers: [
|
|
|
SliverToBoxAdapter(child: SizedBox(width: 12.w)),
|
|
|
- buildGoRecordView(),
|
|
|
Obx(() {
|
|
|
return SliverList.builder(
|
|
|
itemBuilder: _builderTalkItem,
|
|
|
@@ -354,79 +482,98 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
margin: EdgeInsets.only(right: 8.w),
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
- border: Border.all(color: '#F0F0F0'.toColor(), width: 1),
|
|
|
- borderRadius: BorderRadius.circular(8),
|
|
|
+ border: Border.all(color: '#F0F0F0'.toColor(), width: 2),
|
|
|
+ borderRadius: const BorderRadius.only(
|
|
|
+ topLeft: Radius.circular(12),
|
|
|
+ topRight: Radius.circular(24),
|
|
|
+ bottomRight: Radius.circular(12),
|
|
|
+ bottomLeft: Radius.circular(12)),
|
|
|
),
|
|
|
- height: double.infinity,
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
- child: Column(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ padding: EdgeInsets.only(left: 10.w, right: 16.w),
|
|
|
+ child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- _buildTag(item),
|
|
|
- Text(item.title.value.orEmpty,
|
|
|
- maxLines: 1,
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 15.sp,
|
|
|
- color: ColorName.primaryTextColor,
|
|
|
- fontWeight: FontWeight.bold))
|
|
|
- ],
|
|
|
- ),
|
|
|
- SizedBox(height: 5.h),
|
|
|
- Text(
|
|
|
- item.summary.value.orEmpty,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.secondaryTextColor),
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- maxLines: 2,
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.only(top: 14).h,
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: 35.w,
|
|
|
+ height: 40.w,
|
|
|
+ child: Assets.images.iconFilesFile.image()),
|
|
|
+ Visibility(
|
|
|
+ visible: item.isExample.isTrue,
|
|
|
+ child: Container(
|
|
|
+ margin: const EdgeInsets.only(top: 32).w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: "#B2BAC4".toColor(),
|
|
|
+ borderRadius: BorderRadius.circular(4)),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ horizontal: 5.5, vertical: 2)
|
|
|
+ .w,
|
|
|
+ child: Text(StringName.homeTalkExample.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ height: 1,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.white)),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- SizedBox(height: 8.h),
|
|
|
- Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text(item.duration.toFormattedDuration(),
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.tertiaryTextColor)),
|
|
|
- SizedBox(width: 6.w),
|
|
|
- Container(
|
|
|
- width: 1, height: 9, color: ColorName.tertiaryTextColor),
|
|
|
- SizedBox(width: 6.w),
|
|
|
- Text(item.createTime.orEmpty,
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text(item.title.value.orEmpty,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 15.sp,
|
|
|
+ color: ColorName.primaryTextColor,
|
|
|
+ fontWeight: FontWeight.bold))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 5.h),
|
|
|
+ Text(
|
|
|
+ item.summary.value.orEmpty,
|
|
|
style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.tertiaryTextColor))
|
|
|
- ],
|
|
|
+ fontSize: 12.sp, color: ColorName.secondaryTextColor),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ maxLines: 2,
|
|
|
+ ),
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(item.duration.toFormattedDuration(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor)),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Container(
|
|
|
+ width: 1,
|
|
|
+ height: 9,
|
|
|
+ color: ColorName.tertiaryTextColor),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Text(item.createTime.orEmpty,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _buildTag(TalkBean item) {
|
|
|
- return Visibility(
|
|
|
- visible: item.isExample.isTrue ||
|
|
|
- item.status.value == TalkStatus.analysing ||
|
|
|
- item.status.value == TalkStatus.waitAnalysis,
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.only(right: 6.w),
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3).w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: '#DFE4FC'.toColor(),
|
|
|
- borderRadius: BorderRadius.circular(4),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- textAlign: TextAlign.center,
|
|
|
- (item.isExample.isTrue)
|
|
|
- ? StringName.homeTalkExample.tr
|
|
|
- : StringName.analysis.tr,
|
|
|
- style: TextStyle(
|
|
|
- height: 1.0, fontSize: 12.sp, color: ColorName.colorPrimary),
|
|
|
- )),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
Widget buildTitle(String titleName, VoidCallback? onTap) {
|
|
|
return Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12).w,
|
|
|
@@ -451,7 +598,7 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
Text(
|
|
|
StringName.homeTalkSeeAll.tr,
|
|
|
style: TextStyle(
|
|
|
- fontSize: 13.sp, color: ColorName.secondaryTextColor),
|
|
|
+ fontSize: 13.sp, color: ColorName.tertiaryTextColor),
|
|
|
),
|
|
|
Container(
|
|
|
margin: const EdgeInsets.only(bottom: 1),
|