| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- import 'dart:math' as math;
- import 'package:bbyyy/beans/goods_bean_entity.dart';
- import 'package:bbyyy/https/url.dart';
- import 'package:bbyyy/my_tools/AsperctRaioImage.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:flutter/material.dart';
- class OrderPage extends StatefulWidget {
- GoodsBeanDataData data;
- OrderPage(this.data);
- @override
- _OrderPageState createState() => _OrderPageState(data);
- }
- class _OrderPageState extends State<OrderPage> {
- List<String> status = ['未支付', '代支付', '已支付'];
- List<Color> statusColors = [
- MyColors.cFF9353,
- MyColors.c73C2FF,
- MyColors.cADD358
- ];
- int statusIndex = 0;
- GoodsBeanDataData data;
- _OrderPageState(this.data);
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- statusIndex = math.Random().nextInt(3);
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: MyColors.cF7F7F7,
- body: Column(
- children: [
- MyViews().myAppBar('订单详情', context, []),
- Expanded(
- child: Stack(
- children: [
- SingleChildScrollView(
- child: Column(
- children: [
- MyViews().netImg(
- imgURL(data.coverPath), 314, double.infinity,
- placeholder: 'images/svg/goodsDefImg.svg'),
- Container(
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(15, 15, 15, 18),
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(bottom: 11),
- child: Text(
- '${data.title}\n${data.description}',
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 15,
- height: 1.4),
- ),
- ),
- Row(
- children: [
- Text(
- '¥${data.price}',
- style: TextStyle(
- color: MyColors.cFF4233, fontSize: 17),
- ),
- Text(
- 'x${data.stock}',
- style: TextStyle(
- color: MyColors.c666666, fontSize: 17),
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- Container(
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(12, 2, 12, 2),
- margin: EdgeInsets.only(top: 5),
- child: Row(
- children: [
- ClipRRect(
- child: MyViews().netImg('path', 40, 40),
- borderRadius:
- BorderRadius.all(Radius.circular(20)),
- ),
- Container(
- margin: EdgeInsets.only(left: 7, right: 8),
- child: Text(
- '爱吃饼干的小猪',
- style: TextStyle(
- color: MyColors.c333333, fontSize: 15),
- ),
- ),
- Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: MyColors.cFF4233, width: 1),
- borderRadius: BorderRadius.circular(2),
- ),
- height: 14,
- width: 26,
- child: Text(
- '卖家',
- style: TextStyle(
- color: MyColors.cFF4233,
- fontSize: 10,
- height: 1),
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: 1),
- )
- ],
- ),
- ),
- Container(
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(15, 15, 17, 15),
- margin: EdgeInsets.only(top: 5),
- child: Row(
- children: [
- MyViews().myText('优惠', MyColors.c333333, 15),
- MyViews().myText('-¥6.00', MyColors.c666666, 15),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Column(
- children: images(),
- ),
- Container(
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(15, 15, 17, 15),
- margin: EdgeInsets.only(top: 1),
- child: Row(
- children: [
- MyViews().myText('合计', MyColors.c333333, 15),
- MyViews().myText('¥114.00', MyColors.c666666, 15),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Container(
- color: Colors.white,
- padding: EdgeInsets.fromLTRB(15, 15, 17, 15),
- margin: EdgeInsets.only(top: 5),
- child: Row(
- children: [
- MyViews().myText('下单时间', MyColors.c333333, 15),
- MyViews().myText(
- '2020-12-24 10:00:00', MyColors.c666666, 15),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- ],
- ),
- ),
- Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- bottomRight: Radius.circular(21),
- bottomLeft: Radius.circular(21),
- ),
- color: Colors.white),
- height: 56,
- padding: EdgeInsets.only(left: 16, right: 14),
- child: Row(
- children: [
- ClipRRect(
- child:
- MyViews().netImg(imgURL(data.userPic), 40, 40),
- borderRadius: BorderRadius.all(Radius.circular(20)),
- ),
- Expanded(
- child: Container(
- height: 40,
- margin: EdgeInsets.only(left: 10),
- child: Column(
- children: [
- Row(
- children: [
- MyViews().myText(
- data.userName, MyColors.c333333, 15),
- Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: MyColors.cFF4233, width: 1),
- borderRadius: BorderRadius.circular(2),
- ),
- margin: EdgeInsets.only(left: 10),
- height: 14,
- width: 26,
- child: Text(
- '买家',
- style: TextStyle(
- color: MyColors.cFF4233,
- fontSize: 10,
- height: 1),
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: 1),
- )
- ],
- ),
- MyViews().myText('全球带货达人团', MyColors.c999999, 12),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- ),
- Container(
- decoration: BoxDecoration(
- color: statusColors[statusIndex],
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(7),
- bottomRight: Radius.circular(7),
- ),
- ),
- child: MyViews().myText(
- status[statusIndex], Colors.white, 10,
- height: 1),
- height: 18,
- width: 40,
- alignment: Alignment.center,
- )
- ],
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: statusIndex == 0,
- child: SafeArea(
- top: false,
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 37),
- color: Colors.white,
- width: double.infinity,
- height: 80,
- child: Visibility(
- visible: statusIndex == 0,
- child: Row(
- children: [
- Expanded(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(20),
- bottomLeft: Radius.circular(20),
- ),
- border: Border.all(
- color: MyColors.cFF4233, width: 1)),
- height: 40,
- child:
- MyViews().myText('取消订单', MyColors.cFF4233, 14),
- alignment: Alignment.center),
- ),
- Expanded(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- color: MyColors.cFF4233),
- height: 40,
- child: MyViews().myText('立即支付', Colors.white, 14),
- alignment: Alignment.center),
- )
- ],
- ),
- ),
- ),
- ),
- )
- ],
- ),
- );
- }
- images() {
- List<Widget> imgs = [];
- data.pictures.split(',').forEach((element) {
- imgs.add(AsperctRaioImage.network(imgURL(element),
- builder: (context, snapshot, url) {
- return MyViews().netImg(
- imgURL(element),
- (snapshot.data.height.toDouble() / 5) /
- (snapshot.data.width.toDouble() / 5) *
- MediaQuery.of(context).size.width,
- MediaQuery.of(context).size.width,placeholder: 'images/svg/goodsDefImg.svg');
- }));
- });
- return imgs;
- }
- }
|