-
-
Save lishuhao/4f5835475cd3bd337236cd289f9c3427 to your computer and use it in GitHub Desktop.
showModalBottomSheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| persistentFooterButtons: <Widget>[ | |
| new FlatButton( | |
| onPressed: (){ | |
| showModalBottomSheet<String>(context: context, builder: (BuildContext context){ | |
| return new GestureDetector( | |
| onTap: (){}, | |
| child: _selectProductSpec(), | |
| ); | |
| }); | |
| }, | |
| child: new Text('加入购物车') | |
| ), | |
| ], | |
| //弹出底部对话框,选择产品规格 | |
| Widget _selectProductSpec(){ | |
| return new Container( | |
| padding: const EdgeInsets.all(10.0), | |
| child: new Column( | |
| children: <Widget>[ | |
| new Padding( | |
| padding: const EdgeInsets.only(bottom: 10.0), | |
| child: new Row( | |
| children: <Widget>[ | |
| new Text(_product['name'], | |
| style: const TextStyle(fontSize: 16.0), | |
| ), | |
| ], | |
| ), | |
| ), | |
| new Divider(color: Colors.black38,), | |
| new Expanded(child: new CustomScrollView( | |
| slivers: <Widget>[ | |
| new SliverList( | |
| delegate: new SliverChildListDelegate( | |
| _product['spec'].map((Map spec){ | |
| return new Row( | |
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
| children: <Widget>[ | |
| new Text(spec['name']), | |
| new Text('总价¥'+spec['price'].toString()), | |
| new IconButton(icon: const Icon(Icons.add_shopping_cart), onPressed: (){ | |
| print('ll'); | |
| }) | |
| ], | |
| ); | |
| }).toList() | |
| ) | |
| ) | |
| ], | |
| )), | |
| ], | |
| ), | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment