1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- part of cool_ui;
- class CupertinoPopoverMenuList extends StatelessWidget{
- final List<Widget> children;
- const CupertinoPopoverMenuList({this.children});
- @override
- Widget build(BuildContext context) {
- return ListView.builder(
- itemCount: children.length * 2 - 1,
- itemBuilder: (context,int i){
- if(i.isOdd){
- // 在每一列之前,添加一个1像素高的分隔线widget
- return const Divider(height: 1.0,);
- }
- final int index=i ~/2;
- return children[index];
- },
- padding: EdgeInsets.all(0.0),
- );
- }
- }
- class CupertinoPopoverMenuItem extends StatelessWidget{
- final Widget leading;
- final Widget child;
- const CupertinoPopoverMenuItem({this.leading,this.child});
- @override
- Widget build(BuildContext context) {
- List<Widget> widgets = [];
- if(leading != null){
- widgets.add(Container(
- padding: EdgeInsets.only(left:5.0,right: 5.0),
- width: 35.0,
- height: 35.0,
- child: IconTheme(
- data:IconThemeData(color: Color(0xff007aff),size: 20.0),
- child: leading
- ),
- ));
- }
- widgets.add(Expanded(child: DefaultTextStyle(style: TextStyle(
- color: Color(0xff007aff),
- fontSize: 17.0
- ), child: child)));
- return Padding(
- padding: EdgeInsets.only(top:2.5,bottom: 2.5),
- child: Row(
- children: widgets
- ),
- );
- }
- }
|