|
|
|
|
|
|
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|
|
|
using ui_ = Unity.UIWidgets.widgets.ui_; |
|
|
|
using Unity.UIWidgets.cupertino; |
|
|
|
using Unity.UIWidgets.rendering; |
|
|
|
|
|
|
|
namespace UIWidgetsSample |
|
|
|
{ |
|
|
|
|
|
|
onPressed: () => |
|
|
|
{ |
|
|
|
Navigator.of(contex1).push( |
|
|
|
new CupertinoPageRoute(builder: (conte2) => |
|
|
|
new CupertinoPageRoute(builder: (contex3) => |
|
|
|
return new DetailScreen(index==0? "views" : "articles" ); |
|
|
|
return new DetailScreen1(index==0? "views" : "articles" ); |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
public class DetailScreen : StatelessWidget |
|
|
|
|
|
|
|
public class DetailScreen1 : StatelessWidget |
|
|
|
public DetailScreen(string topic) |
|
|
|
public DetailScreen1(string topic) |
|
|
|
{ |
|
|
|
this.topic = topic; |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
return new CupertinoPageScaffold( |
|
|
|
navigationBar: new CupertinoNavigationBar( |
|
|
|
middle: new Text("Details") |
|
|
|
//middle: new Text("Details")
|
|
|
|
|
|
|
|
child: new Text("hello world") |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
public class DetailScreen : StatefulWidget |
|
|
|
{ |
|
|
|
public DetailScreen(string topic) |
|
|
|
{ |
|
|
|
this.topic = topic; |
|
|
|
} |
|
|
|
public string topic; |
|
|
|
|
|
|
|
|
|
|
|
public override State createState() |
|
|
|
{ |
|
|
|
return new DetailScreenState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class DetailScreenState : State<DetailScreen> |
|
|
|
{ |
|
|
|
public bool switchValue = false; |
|
|
|
public override Widget build(BuildContext context) |
|
|
|
{ |
|
|
|
var widgets = new List<Widget>(); |
|
|
|
widgets.Add( new Expanded(child : new Text("a switch"))); |
|
|
|
widgets.Add(new CupertinoSwitch( |
|
|
|
value: switchValue, |
|
|
|
onChanged: value => |
|
|
|
{ |
|
|
|
setState(() => switchValue = value); |
|
|
|
} |
|
|
|
)); |
|
|
|
var rowWidgtes = new List<Widget>(); |
|
|
|
var row = new Row(children:widgets); |
|
|
|
//rowWidgtes.Add(row);
|
|
|
|
|
|
|
|
var cupBtn = new CupertinoButton( |
|
|
|
child: new Text("launch action sheet"), |
|
|
|
onPressed: () => |
|
|
|
{ |
|
|
|
CupertinoRouteUtils.showCupertinoModalPopup( |
|
|
|
context: context, |
|
|
|
builder: (context1) => |
|
|
|
{ |
|
|
|
return new CupertinoActionSheet( |
|
|
|
title: new Text("some choices"), |
|
|
|
actions: new List<Widget>(){ |
|
|
|
new CupertinoActionSheetAction( |
|
|
|
child: new Text("one"), |
|
|
|
onPressed: () => |
|
|
|
{ |
|
|
|
Navigator.pop(context1, 1); |
|
|
|
}, |
|
|
|
isDefaultAction: true |
|
|
|
), |
|
|
|
new CupertinoActionSheetAction( |
|
|
|
child: new Text("two"), |
|
|
|
onPressed: () => |
|
|
|
{ |
|
|
|
Navigator.pop(context1, 2); |
|
|
|
} |
|
|
|
), |
|
|
|
new CupertinoActionSheetAction( |
|
|
|
child: new Text("three"), |
|
|
|
onPressed: () => |
|
|
|
{ |
|
|
|
Navigator.pop(context1, 3); |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
); |
|
|
|
rowWidgtes.Add(cupBtn); |
|
|
|
|
|
|
|
return new CupertinoPageScaffold( |
|
|
|
child: new Center( |
|
|
|
child: new Column( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children:rowWidgtes |
|
|
|
) |
|
|
|
/*, |
|
|
|
navigationBar: new CupertinoNavigationBar( |
|
|
|
middle: new Text("hello world") |
|
|
|
)*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |