| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648 |
- import 'package:electronic_assistant/base/base_page.dart';
- import 'package:electronic_assistant/resource/assets.gen.dart';
- import 'package:electronic_assistant/resource/colors.gen.dart';
- import 'package:electronic_assistant/utils/expand.dart';
- import 'package:electronic_assistant/widget/login_code_btn.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'controller.dart';
- class StorePage extends BasePage<StoreController> {
- const StorePage({super.key});
- @override
- bool immersive() {
- return true;
- }
- @override
- Widget buildBody(BuildContext context) {
- return Stack(
- children: [
- SingleChildScrollView(
- scrollDirection: Axis.vertical,
- child: Stack(
- alignment: AlignmentDirectional.topStart,
- children: [
- _buildBackgroundGradient(),
- _buildTopBG(),
- Positioned(
- left: 12.w,
- top: 280,
- width: ScreenUtil().screenWidth - 24.w,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(
- height: 20.h,
- child: Assets.images.iconStoreDescripe.image(),
- ),
- SizedBox(
- height: 16.h,
- ),
- _buildGoods(),
- SizedBox(
- height: 16.h,
- ),
- Text(
- "·该套餐约可倾听45小时",
- style: TextStyle(
- fontSize: 10.sp,
- color: "#AFAFAF".toColor(),
- ),
- ),
- SizedBox(
- height: 16.h,
- ),
- _buildPayMethod(),
- SizedBox(
- height: 39.h,
- ),
- _buildService(),
- ],
- ),
- ),
- ],
- ),
- ),
- _buildTopBar(),
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: _buildBottombar(),
- ),
- ],
- );
- }
- // 背景颜色
- Widget _buildBackgroundGradient() {
- return Container(
- width: 1.sw,
- height: 1.sh,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: ['#071935'.toColor(), '#283B58'.toColor()],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- stops: const [0.4, 1.0],
- ),
- ),
- );
- }
- // 顶部背景图片
- Widget _buildTopBG() {
- return Assets.images.bgStoreTop.image();
- }
- Widget _buildTopBar() {
- return Container(
- height: 44.h,
- margin: EdgeInsets.only(
- left: 0,
- right: 0,
- top: ScreenUtil().statusBarHeight,
- ),
- padding: EdgeInsets.symmetric(horizontal: 12.w),
- child: Row(
- children: [
- IconButton(
- onPressed: () {},
- icon: ImageIcon(
- Assets.images.iconArrowBackWhite.provider(),
- color: Colors.white,
- ),
- ),
- const Spacer(),
- Container(
- padding:
- EdgeInsets.only(left: 6.w, top: 6.h, bottom: 6.h, right: 12.w),
- decoration: BoxDecoration(
- color: "#01051C".toColor(),
- border: Border.all(
- color: "#7688B1".toColor(),
- width: 1,
- ),
- borderRadius: BorderRadius.circular(16.h),
- ),
- child: Row(
- children: [
- SizedBox(
- width: 20,
- child: Assets.images.iconStoreLogo.image(),
- ),
- SizedBox(
- width: 3.w,
- ),
- const Text(
- "电量 ",
- style: TextStyle(
- fontSize: 12,
- color: Colors.white,
- ),
- ),
- Text(
- "600",
- style: TextStyle(
- fontSize: 12,
- color: Colors.white,
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildGoods() {
- return SizedBox(
- height: 154,
- child: ListView.builder(
- scrollDirection: Axis.horizontal,
- padding: const EdgeInsets.only(top: 0),
- itemBuilder: (context, index) {
- return _buildGoodItem();
- },
- itemCount: 4,
- ),
- );
- }
- Widget _buildGoodItem() {
- return Container(
- height: 154,
- width: 132,
- margin: const EdgeInsets.only(right: 10),
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- Positioned(
- left: 0,
- top: 10,
- width: 132,
- height: 144,
- child: Container(
- padding: const EdgeInsets.all(2),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(12),
- gradient: LinearGradient(
- colors: ['#9075FF'.toColor(), '#4366FF'.toColor()],
- begin: Alignment.centerLeft,
- end: Alignment.centerRight,
- stops: const [0.0, 1.0],
- ),
- ),
- child: Container(
- width: 128,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: ['#FFF3F6'.toColor(), '#DADBFF'.toColor()],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- stops: const [0.0, 1.0],
- ),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 12,
- ),
- Text(
- "大电池",
- style: TextStyle(
- fontSize: 13,
- fontWeight: FontWeight.w700,
- color: "#6177F2".toColor(),
- ),
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- margin: EdgeInsets.only(bottom: 9),
- child: Text(
- "¥",
- style: TextStyle(
- fontSize: 16,
- color: "#6177F2".toColor(),
- ),
- ),
- ),
- Text(
- "198",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 39,
- fontWeight: FontWeight.bold,
- color: "#6177F2".toColor(),
- ),
- ),
- ],
- ),
- Text(
- "¥258",
- style: TextStyle(
- color: "#AFAFAF".toColor(),
- decoration: TextDecoration.lineThrough,
- decorationColor: "#AFAFAF".toColor(),
- fontSize: 14.0,
- ),
- ),
- Container(
- padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: ['#9075FF'.toColor(), '#4366FF'.toColor()],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- stops: const [0.0, 1.0],
- ),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- SizedBox(
- width: 16,
- child: Assets.images.iconStoreGoodFlash.image(),
- ),
- Text(
- "550电量",
- style: TextStyle(
- fontSize: 13,
- color: Colors.white,
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ),
- Stack(
- children: [
- Container(
- height: 29,
- child: Assets.images.iconStoreGoodTag.image(),
- ),
- Positioned(
- left: 8,
- top: 2,
- child: Text(
- "最多人买",
- style: TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: "#703D27".toColor(),
- ),
- ),
- ),
- ],
- ),
- ],
- ),
- );
- }
- Widget _buildTopPayMethod(Image icon, String title) {
- return Row(
- children: [
- SizedBox(
- width: 20.w,
- child: icon,
- ),
- const SizedBox(
- width: 6,
- ),
- Text(
- title,
- style: TextStyle(color: Colors.white, fontSize: 14.sp),
- ),
- ],
- );
- }
- Widget _buildPayMethod() {
- return Column(
- children: [
- Row(
- children: [
- Text(
- "支付方式",
- style: TextStyle(
- fontSize: 14.sp,
- color: Colors.white,
- fontWeight: FontWeight.w500,
- ),
- ),
- const Spacer(),
- Obx(() {
- return GestureDetector(
- onTap: () {
- controller.isExpanded.value = !controller.isExpanded.value;
- },
- child: Row(
- children: [
- Visibility(
- visible: !controller.isExpanded.value,
- child: _buildTopPayMethod(
- Assets.images.iconStoreAlipay.image(),
- "支付宝",
- ),
- ),
- Visibility(
- visible: controller.isExpanded.value,
- child: Text(
- "收起",
- style: TextStyle(
- fontSize: 14.sp,
- color: Colors.white,
- ),
- ),
- ),
- Container(
- width: 16.w,
- child: controller.isExpanded.value
- ? Assets.images.iconArrowUpWhite.image()
- : Assets.images.iconArrowDownWhite.image(),
- ),
- ],
- ),
- );
- }),
- ],
- ),
- Obx(() {
- return Visibility(
- visible: controller.isExpanded.value,
- child: SizedBox(
- height: 2 * 32,
- child: ListView.builder(
- padding: const EdgeInsets.only(top: 0),
- physics: const NeverScrollableScrollPhysics(),
- itemBuilder: (context, index) {
- return _buildPayItem(
- Assets.images.iconStoreAlipay.image().obs.value,
- "支付宝",
- true);
- },
- itemCount: 2,
- ),
- ),
- );
- }),
- ],
- );
- }
- Widget _buildPayItem(Image icon, String title, bool isSelect) {
- return Container(
- height: 20.h,
- margin: const EdgeInsets.only(top: 12),
- child: Row(
- children: [
- SizedBox(
- width: 20.w,
- child: icon,
- ),
- const SizedBox(
- width: 6,
- ),
- Text(
- title,
- style: TextStyle(color: Colors.white, fontSize: 14.sp),
- ),
- const Spacer(),
- GestureDetector(
- onTap: () {
- // controller.isAgree.value = !controller.isAgree.value;
- },
- child: SizedBox(
- width: 20.w,
- height: 20.w,
- child: isSelect
- ? Assets.images.iconSelectTrue.image()
- : Assets.images.iconSelectFalse.image(),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildService() {
- return Column(
- children: [
- Row(
- children: [
- Container(
- width: 4.w,
- height: 16.h,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(2),
- gradient: LinearGradient(
- colors: ['#357AFF'.toColor(), '#E389FF'.toColor()],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- stops: const [0.0, 1.0],
- ),
- ),
- ),
- SizedBox(
- width: 6.w,
- ),
- Text(
- "多种专属服务·高效辅助办公",
- style: TextStyle(
- fontSize: 15.sp,
- color: Colors.white,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- Container(
- padding: EdgeInsets.only(
- left: 9,
- right: 9,
- top: 16,
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- _buildServiceItem(
- Assets.images.iconStoreServiceSum.image(),
- "智能谈话总结",
- ),
- _buildServiceItem(
- Assets.images.iconStoreServiceRemain.image(),
- "待办任务处理",
- ),
- _buildServiceItem(
- Assets.images.iconStoreServiceAdvice.image(),
- "专业工作建议",
- ),
- _buildServiceItem(
- Assets.images.iconStoreServiceDeal.image(),
- "处理交代事宜",
- ),
- ],
- ),
- ),
- SizedBox(
- height: 26.h,
- ),
- Container(
- width: double.infinity,
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
- decoration: BoxDecoration(
- color: "#40567D".toColor().withOpacity(0.2),
- borderRadius: BorderRadius.circular(8),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "扣电规则",
- style: TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: Colors.white.withOpacity(0.6),
- ),
- ),
- SizedBox(
- height: 6.h,
- ),
- Text(
- "1、小听每听5分钟扣1电量,不满5分钟按5分钟算。",
- style: TextStyle(
- fontSize: 12,
- color: Colors.white.withOpacity(0.6),
- ),
- ),
- Text(
- "2、大文件、超大文件生成新的总结,每次扣1电量。",
- style: TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: Colors.white.withOpacity(0.6),
- ),
- ),
- Text(
- "3、用大文件和小听对话,每次对话扣1电量。",
- style: TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- color: Colors.white.withOpacity(0.6),
- ),
- ),
- ],
- ),
- ),
- ],
- );
- }
- Widget _buildServiceItem(Image icon, String title) {
- return Column(
- children: [
- SizedBox(
- width: 32.w,
- child: icon,
- ),
- SizedBox(
- height: 2.h,
- ),
- Text(
- title,
- style: TextStyle(
- color: ColorName.white.withOpacity(0.8),
- fontSize: 11.sp,
- ),
- ),
- ],
- );
- }
- Widget _buildBottombar() {
- return Container(
- padding: EdgeInsets.only(
- left: 16.w,
- right: 16.w,
- top: 12.h,
- bottom: ScreenUtil().bottomBarHeight + 12.h),
- alignment: Alignment.topCenter,
- decoration: BoxDecoration(
- color: "#283B58".toColor(),
- boxShadow: const [
- BoxShadow(
- color: Color.fromARGB(1, 42, 48, 59), // 阴影颜色
- spreadRadius: 0, // 阴影扩散半径
- blurRadius: 20, // 阴影模糊半径
- offset: Offset(0, 0), // 阴影偏移量
- ),
- ],
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(12.w),
- topRight: Radius.circular(12.w),
- ),
- ),
- child: GestureDetector(
- onTap: () {
- // print(ScreenUtil().bottomBarHeight);
- },
- child: Container(
- height: 48.h,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: ['#9075FF'.toColor(), '#4366FF'.toColor()],
- begin: Alignment.centerRight,
- end: Alignment.centerRight,
- stops: const [0.0, 1.0],
- ),
- borderRadius: BorderRadius.circular(8.h),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- "立即购买",
- style: TextStyle(
- color: Colors.white,
- fontSize: 16.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- SizedBox(
- width: 4.w,
- ),
- Text(
- "¥198",
- style: TextStyle(
- color: Colors.white,
- fontSize: 18.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|