Flutter mobile provider combat - (49) make detailed page _Stack bottom toolbar

He has been suspended in the bottom

Stack stacked assembly. Row with horizontal layout which can

Start

If you want to stack positioning will use the position to locate.

Modify this place return return value

Big R Refresh to view results, you can see the words fixed test in the lower left corner. It has been fixed to the bottom

Do the bottom of the fixed bar widget

New page: In the folder details_page / details_bottom.dart layout with three InkWell as are clickable

Add to the cart InkWell

Buy Now, copy the shopping cart InkWell change to change it.

Referring to this component

Show results

The final code:

details_bottom.dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DetailsBottom extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: ScreenUtil().setWidth(750),
      color: Colors.white,
      height: ScreenUtil().setHeight(80),
      child: Row(
        children: <Widget>[
          InkWell(
            onTap: (){},
            child: Container(
              width: ScreenUtil().setWidth(110),
              alignment: Alignment.center,
              child: Icon(
                Icons.shopping_cart,
                size: 35, // no icon is provided if the size of the size of the adaptive 
                Color: Colors.red, 
              ), 
            ),             
          ), 
          Inkwell ( 
            onTap in: () {}, 
            Child: Container ( 
              Alignment: Alignment.center, 
              width: ScreenUtil ( ) .setWidth (320), // 750 - 110 divided by 2 Rating 
              height: ScreenUtil () setHeight (80),. 
              Color: Colors.green, 
              Child: the Text ( 
                'Add to cart', 
                style: the TextStyle (Color: Colors.white, the fontSize:. ScreenUtil () setSp (28)), 
              ), 
            ), 
          ), 
          Inkwell (
            onTap in: () {},
            child: Container(
              Alignment: Alignment.center, 
              width:. ScreenUtil () setWidth (320.), // 750 - 110 divided by 2 Rating 
              height: ScreenUtil () setHeight (80),. 
              Color: Colors.red, 
              Child: the Text ( 
                'immediately Buy ', 
                style: the TextStyle (Color: Colors.white, the fontSize: ScreenUtil () setSp (28).), 
              ), 
            ), 
          ) 
        ], 
      ), 
    ); 
  } 
}

details_page.dart

import 'package:flutter/material.dart';
import 'package:provide/provide.dart';
import '../provide/details_info.dart';
import './details_page/details_top_area.dart';
import './details_page/details_expain.dart';
import './details_page/details_tabbar.dart';
import './details_page/details_web.dart';
import './details_page/details_bottom.dart';

class DetailsPage extends StatelessWidget {
  final String goodsId;

  DetailsPage(this.goodsId);//flutter 1.2的最新的写法 构造函数

  @override
  Widget build(BuildContext context) {
 
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back),
          onPressed: () { 
            Navigator.pop (context); // return a page 
          }, 
        ), 
        title: the Text ( 'Detail pages'), 
      ), 
      body: FutureBuilder ( 
        Future: _getBackInfo (context), 
        Builder: (context , Snapshot) { 
          // determines whether there is data 
          IF (snapshot.hasData) { 
            // If there is data to return a Container 
            return Stack ( 
              Children: <the Widget> [ 
                Container ( 
                  Child: the ListView ( 
                    Children: <the Widget> [ 
                      DetailsTopArea (), 
                      DetailsExplain (), 
                      DetailsTabbar (), 
                      DetailsWeb () 
                    ],
                  ), 
                ), 

                Positioned ( 
                  bottom: 0, 
                  left: 0, 
                  Child: DetailsBottom (), 
                ) 
              ], 
            ); 
          } the else { 
            return the Text ( 'Loading ......'); // without data 
          } 
        }, 
      ), 
    ); 
  } 

  Future _getBackInfo (BuildContext context) the async {
    await Provide.value<DetailsInfoProvide>(context).getGoodsInfo(goodsId);
    // print ( 'loaded ...........'); 
    return 'complete loading'; 
  } 

}

.

Guess you like

Origin www.cnblogs.com/crazycode2/p/11524489.html