Flutter imitation Jingdong Mall project settlement Page Layout

Flutter imitation Jingdong Mall project settlement Page Layout

 

CheckOut.dart

Copy the code
import 'package:flutter/material.dart';
import 'package:flutter_jdshop/services/ScreenAdapter.dart';

class CheckOutPage extends StatefulWidget {
  CheckOutPage({Key key}) : super(key: key);

  _CheckOutPageState createState() => _CheckOutPageState();
}

class _CheckOutPageState extends State<CheckOutPage> {
  Widget _checkOutItem() {
    return Row(
      children: <Widget>[
        Container(
          width: ScreenAdapter.width(160),
          child: Image.network(
              "https://www.itying.com/images/flutter/list2.jpg",
              fit: BoxFit.cover),
        ),
        Expanded(
          flex: 1,
          child: Container(
            padding: EdgeInsets.fromLTRB(10, 10, 10, 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text("华为旗舰店Mate9手机", maxLines: 2),
                Text("白色,175", maxLines: 1),
                Stack(
                  children: <Widget>[
                    Align(
                      alignment: Alignment.centerLeft,
                      child: Text("¥1111", style: TextStyle(color: Colors.red)),
                    ),
                    Align(
                      alignment: Alignment.centerRight,
                      child: Text('x2'),
                    )
                  ],
                )
              ],
            ),
          ),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('结算'),
        ),
        body: Stack(
          children: <Widget>[
            ListView(
              children: <Widget>[
                Container(
                  color: Colors.white,
                  child: Column(
                    children: <Widget>[
                      ListTile ( 
                        leading: Icon (Icons.add_location), 
                        title: Center (Child: Text ( "Please add the shipping address")), 
                        trailing: Icon (Icons.navigate_next), 
                      ), 
                      SizedBox (height: 10), 
                      ListTile ( 
                        leading : Icon (Icons.add_location), 
                        title: the Column ( 
                          crossAxisAlignment: CrossAxisAlignment.start, 
                          Children: <the Widget> [ 
                            the Text ( "Zhang 13,325,187,796 '), 
                            SizedBox(height: 10),
                            the Text (' Haidian District, Beijing ') 
                          ],
                        ),
                        trailing: Icon(Icons.navigate_next),
                      ),
                      SizedBox(height: 10),
                    ],
                  ),
                ),
                SizedBox(height: 20),
                Container(
                  color: Colors.white,
                  padding: EdgeInsets.all(ScreenAdapter.width(20)),
                  child: Column(
                    children: <Widget>[
                      _checkOutItem(),
                      Divider(),
                      _checkOutItem(),
                      Divider (), 
                )
                      _checkOutItem()
                    ], 
                  ), 
                ), 
                Container ( 
                  Color: Colors.white, 
                  padding: EdgeInsets.all (ScreenAdapter.width (20 is)), 
                  Child: the Column ( 
                    crossAxisAlignment: CrossAxisAlignment.start, 
                    Children: <the Widget> [ 
                      the Text ( 'total amount of product 100 ¥ '), 
                      Divider (), 
                      the Text (' stand by: ¥. 5 '), 
                      Divider (), 
                      the Text (' Shipment: ¥. 8 ') 
                    ], 
                  ), 
              ], 
            ),
            Positioned(
              bottom: 0,
              width: ScreenAdapter.width(750),
              height: ScreenAdapter.height(100),
              child: Container(
                width: ScreenAdapter.width(750),
                height: ScreenAdapter.height(100),
                decoration: BoxDecoration(
                    color: Colors.white,
                    border: Border(
                        top: BorderSide(width: 1, color: Colors.black26))),
                child: Stack(
                  children: <Widget>[
                    Align(
                      alignment: Alignment.centerLeft,
                      child:
                          Text("总价:140", style: TextStyle(color: Colors.red)),
                    ),
                    Align(
                      alignment: Alignment.centerRight,
                      child: RaisedButton(
                        child:
                            Text("立即下单", style: TextStyle(color: Colors.white)),
                        color: Colors.red,
                        onPressed: () {},
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ));
  }
}

 

 

CheckOut.dart

Copy the code
import 'package:flutter/material.dart';
import 'package:flutter_jdshop/services/ScreenAdapter.dart';

class CheckOutPage extends StatefulWidget {
  CheckOutPage({Key key}) : super(key: key);

  _CheckOutPageState createState() => _CheckOutPageState();
}

class _CheckOutPageState extends State<CheckOutPage> {
  Widget _checkOutItem() {
    return Row(
      children: <Widget>[
        Container(
          width: ScreenAdapter.width(160),
          child: Image.network(
              "https://www.itying.com/images/flutter/list2.jpg",
              fit: BoxFit.cover),
        ),
        Expanded(
          flex: 1,
          child: Container(
            padding: EdgeInsets.fromLTRB(10, 10, 10, 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text("华为旗舰店Mate9手机", maxLines: 2),
                Text("白色,175", maxLines: 1),
                Stack(
                  children: <Widget>[
                    Align(
                      alignment: Alignment.centerLeft,
                      child: Text("¥1111", style: TextStyle(color: Colors.red)),
                    ),
                    Align(
                      alignment: Alignment.centerRight,
                      child: Text('x2'),
                    )
                  ],
                )
              ],
            ),
          ),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('结算'),
        ),
        body: Stack(
          children: <Widget>[
            ListView(
              children: <Widget>[
                Container(
                  color: Colors.white,
                  child: Column(
                    children: <Widget>[
                      ListTile(
                        leading: Icon(Icons.add_location),
                        title: Center(child: Text("请添加收货地址")),
                        trailing: Icon(Icons.navigate_next),
                      ),
                      SizedBox(height: 10),
                      ListTile(
                        leading: Icon(Icons.add_location),
                        title: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text('张三 13325187796'),
                            SizedBox(height: 10),
                            Text('北京海淀区')
                          ],
                        ),
                        trailing: Icon(Icons.navigate_next),
                      ),
                      SizedBox(height: 10),
                    ],
                  ),
                ),
                SizedBox(height: 20),
                Container(
                  color: Colors.white,
                  padding: EdgeInsets.all(ScreenAdapter.width(20)),
                  child: Column(
                    children: <Widget>[
                      _checkOutItem(),
                      Divider(),
                      _checkOutItem(),
                      Divider(),
                      _checkOutItem()
                    ],
                  ),
                ),
                Container(
                  color: Colors.white,
                  padding: EdgeInsets.all(ScreenAdapter.width(20)),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Text('商品总金额¥100'),
                      Divider(),
                      Text('立减:¥5'),
                      Divider(),
                      Text('运费:¥8')
                    ],
                  ),
                )
              ],
            ),
            Positioned(
              bottom: 0,
              width: ScreenAdapter.width(750),
              height: ScreenAdapter.height(100),
              child: Container(
                width: ScreenAdapter.width(750),
                height: ScreenAdapter.height(100),
                decoration: BoxDecoration(
                    color: Colors.white,
                    border: Border(
                        top: BorderSide(width: 1, color: Colors.black26))),
                child: Stack(
                  children: <Widget>[
                    Align(
                      alignment: Alignment.centerLeft,
                      child:
                          Text("总价:140", style: TextStyle(color: Colors.red)),
                    ),
                    Align(
                      alignment: Alignment.centerRight,
                      child: RaisedButton(
                        child:
                            Text("立即下单", style: TextStyle(color: Colors.white)),
                        color: Colors.red,
                        onPressed: () {},
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ));
  }
}

 

Guess you like

Origin www.cnblogs.com/zxh1919/p/12564526.html