浏览代码

update 2 demo

/zgh-devtools
guanghuispark 4 年前
当前提交
f8376c25
共有 2 个文件被更改,包括 268 次插入231 次删除
  1. 17
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_activity_indicator_demo.cs
  2. 482
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs

17
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_activity_indicator_demo.cs


using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery.gallery {
/*
class CupertinoProgressIndicatorDemo : StatelessWidget {
public static string routeName = "/cupertino/progress_indicator";
public override
Widget build(BuildContext context) {
public class CupertinoProgressIndicatorDemo : StatelessWidget {
public CupertinoProgressIndicatorDemo(){}
public override Widget build(BuildContext context) {
previousPageTitle: "Cupertino",
middle: new Text("Activity Indicator"),
trailing: new CupertinoDemoDocumentationButton(routeName)
automaticallyImplyLeading: false,
middle: new Text(
"Activity Indicator"
)
),
child: new Center(
child: new CupertinoActivityIndicator()

}
*/
}

482
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs


//using RSG;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
//using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

public override Widget build(BuildContext context) {
return new CupertinoButton(
padding: EdgeInsets.zero,
child: new Text("Exit"),
child: new Tooltip(
message: "Back",
child: new Text("Exit"),
excludeFromSemantics: true
),
onPressed: () => { Navigator.of(context, rootNavigator: true).pop<object>(); }
);
}

public override Widget build(BuildContext context) {
return new CupertinoPageScaffold(
backgroundColor: CupertinoColors.systemGroupedBackground,
child: new CustomScrollView(
slivers: new List<Widget> {
new CupertinoSliverNavigationBar(

public readonly Color color;
public readonly string colorName;
public override Widget build(BuildContext context) {
public override Widget build(BuildContext context)
{
onTap: () => {
onTap: () =>
{
Navigator.of(context).push(new CupertinoPageRoute(
title: colorName,
builder: (BuildContext _context) => new Tab1ItemPage(

)
));
},
child: new SafeArea(
top: false,
bottom: false,
child: new Padding(
padding: EdgeInsets.only(left: 16.0f, top: 8.0f, bottom: 8.0f, right: 8.0f),
child: new Row(
children: new List<Widget> {
new Container(
height: 60.0f,
width: 60.0f,
decoration: new BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(8.0f)
)
),
new Expanded(
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 12.0f),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget> {
new Text(colorName),
new Padding(padding: EdgeInsets.only(top: 8.0f)),
new Text(
"Buy this cool color",
style: new TextStyle(
color: new Color(0xFF8E8E93),
fontSize: 13.0f,
fontWeight: FontWeight.w300
child: new Container(
color: CupertinoDynamicColor.resolve(CupertinoColors.systemBackground, context),
child: new SafeArea(
top: false,
bottom: false,
child: new Padding(
padding: EdgeInsets.only(left: 16.0f, top: 8.0f, bottom: 8.0f, right: 8.0f),
child: new Row(
children: new List<Widget>
{
new Container(
height: 60.0f,
width: 60.0f,
decoration: new BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(8.0f)
)
),
new Expanded(
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 12.0f),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget>
{
new Text(colorName),
new Padding(padding: EdgeInsets.only(top: 8.0f)),
new Text(
"Buy this cool color",
style: new TextStyle(
color: CupertinoDynamicColor.resolve(
CupertinoColors.secondaryLabel, context),
fontSize: 13.0f,
fontWeight: FontWeight.w300
)
)
}
}
)
)
),
new CupertinoButton(
padding: EdgeInsets.zero,
child: new Icon(CupertinoIcons.plus_circled
onPressed: () => { }
),
new CupertinoButton(
padding: EdgeInsets.zero,
child: new Icon(CupertinoIcons.share
new CupertinoButton(
padding: EdgeInsets.zero,
child: new Icon(CupertinoIcons.plus_circled
),
onPressed: () => { }
onPressed: () => { }
)
}
new CupertinoButton(
padding: EdgeInsets.zero,
child: new Icon(CupertinoIcons.share
),
onPressed: () => { }
)
}
)
);
if (lastItem) {
);
if (lastItem) {
return row;
}

new Container(
height: 1.0f,
color: new Color(0xFFD9D9D9)
color: CupertinoDynamicColor.resolve(CupertinoColors.separator, context)
)
}
);

trailing: new ExitButton()
),
child: new SafeArea(
top: false,
bottom: false,
child: new ListView(
children: new List<Widget> {

new Text(
$"Item number {widget.index}",
style: new TextStyle(
color: new Color(0xFF8E8E93),
color: CupertinoDynamicColor.resolve(CupertinoColors.secondaryLabel, context),
fontSize: 16.0f,
fontWeight: FontWeight.w100
)

CupertinoButton.filled(
minSize: 30.0f,
padding: EdgeInsets.zero,
borderRadius: BorderRadius.circular(16.0f),
borderRadius: BorderRadius.circular(32.0f),
child: new Icon(CupertinoIcons.ellipsis),
onPressed: () => { }
)

class CupertinoDemoTab2 : StatelessWidget {
public override Widget build(BuildContext context) {
var listViewList = new List<Widget>();
listViewList.Add(new Tab2Header());
listViewList.Add(new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,
child: new Tab2Header()
));
listViewList.AddRange(CupertinoNavigationDemoUtils.buildTab2Conversation());
return new CupertinoPageScaffold(

}
class Tab2Header : StatelessWidget {
public override Widget build(BuildContext context) {
public override Widget build(BuildContext context)
{
child: new ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(16.0f)),
child: new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
new Container(
decoration: new BoxDecoration(
color: new Color(0xFFE5E5E5)
),
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget> {
new Text(
"SUPPORT TICKET",
style: new TextStyle(
color: new Color(0xFF646464),
letterSpacing: -0.9f,
fontSize: 14.0f,
fontWeight: FontWeight.w500
)
),
new Text(
"Show More",
style: new TextStyle(
color: new Color(0xFF646464),
letterSpacing: -0.6f,
fontSize: 12.0f,
fontWeight: FontWeight.w500
child: new SafeArea(
top: false,
bottom: false,
child: new ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(16.0f)),
child: new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget>
{
new Container(
decoration: new BoxDecoration(
color: CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context)
),
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget>
{
new Text(
"SUPPORT TICKET",
style: new TextStyle(
color: new Color(0xFF646464),
letterSpacing: -0.9f,
fontSize: 14.0f,
fontWeight: FontWeight.w500
)
),
new Text(
"Show More",
style: new TextStyle(
color: CupertinoDynamicColor.resolve(CupertinoColors.secondaryLabel, context),
letterSpacing: -0.6f,
fontSize: 12.0f,
fontWeight: FontWeight.w500
)
)
}
}
)
)
),
new Container(
decoration: new BoxDecoration(
color: new Color(0xFFF3F3F3)
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget> {
new Text(
"Product or product packaging damaged during transit",
style: new TextStyle(
fontSize: 16.0f,
fontWeight: FontWeight.w700,
letterSpacing: -0.46f
)
),
new Padding(padding: EdgeInsets.only(top: 16.0f)),
new Text(
"REVIEWERS",
style: new TextStyle(
color: new Color(0xFF646464),
fontSize: 12.0f,
letterSpacing: -0.6f,
fontWeight: FontWeight.w500
)
),
new Padding(padding: EdgeInsets.only(top: 8.0f)),
new Row(
children: new List<Widget> {
new Container(
width: 44.0f,
height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new FileImage(
file:"test.png"
)
),
shape: BoxShape.circle
)
),
new Padding(padding: EdgeInsets.only(left: 8.0f)),
new Container(
width: 44.0f,
height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new FileImage(
"test.png"
)
),
shape: BoxShape.circle
)
),
new Padding(padding: EdgeInsets.only(left: 2.0f)),
new Icon(
CupertinoIcons.check_mark_circled,
new Container(
decoration: new BoxDecoration(
color: CupertinoDynamicColor.resolve(CupertinoColors.quaternarySystemFill, context)
),
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: new List<Widget>
{
new Text(
"Product or product packaging damaged during transit",
style: new TextStyle(
fontSize: 16.0f,
fontWeight: FontWeight.w700,
letterSpacing: -0.46f
)
),
new Padding(padding: EdgeInsets.only(top: 16.0f)),
new Text(
"REVIEWERS",
style: new TextStyle(
size: 20.0f
fontSize: 12.0f,
letterSpacing: -0.6f,
fontWeight: FontWeight.w500
}
)
}
),
new Padding(padding: EdgeInsets.only(top: 8.0f)),
new Row(
children: new List<Widget>
{
new Container(
width: 44.0f,
height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new FileImage(
file: "test.png"
)
),
shape: BoxShape.circle
)
),
new Padding(padding: EdgeInsets.only(left: 8.0f)),
new Container(
width: 44.0f,
height: 44.0f,
decoration: new BoxDecoration(
image: new DecorationImage(
image: new FileImage(
"test.png"
)
),
shape: BoxShape.circle
)
),
new Padding(padding: EdgeInsets.only(left: 2.0f)),
new Icon(
CupertinoIcons.check_mark_circled,
color: new Color(0xFF646464),
size: 20.0f
)
}
)
}
)
)
}
}
)
)
);
}
)
);
}
}
enum Tab2ConversationBubbleColor {

public readonly Tab2ConversationBubbleColor color;
public override Widget build(BuildContext context) {
Color backgroundColor = null;
Color foregroundColor = null;
switch (color) {
case Tab2ConversationBubbleColor.gray:
backgroundColor = CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context);
foregroundColor = CupertinoDynamicColor.resolve(CupertinoColors.label, context);
break;
case Tab2ConversationBubbleColor.blue:
backgroundColor = CupertinoTheme.of(context).primaryColor;
foregroundColor = CupertinoColors.white;
break;
}
color: color == Tab2ConversationBubbleColor.blue
? CupertinoColors.activeBlue
: CupertinoColors.lightBackgroundGray
color: backgroundColor
child: new Text(text,
child: new Text(
text,
color: color == Tab2ConversationBubbleColor.blue
? CupertinoColors.white
: CupertinoColors.black,
color: foregroundColor,
letterSpacing: -0.4f,
fontSize: 15.0f,
fontWeight: FontWeight.w400

decoration: new BoxDecoration(
shape: BoxShape.circle,
gradient: new LinearGradient(
begin: Alignment.topCenter, // FractionalOfset.topCenter,
end: Alignment.bottomCenter, // FractionalOfset.bottomCenter,
begin: FractionalOffset.topCenter,
end: FractionalOffset.bottomCenter,
Color.fromARGB(color.alpha,
Color.fromARGB(
color.alpha,
(color.red - 60).clamp(0, 255),
(color.green - 60).clamp(0, 255),
(color.blue - 60).clamp(0, 255)

),
margin: EdgeInsets.only(left: 8.0f, bottom: 8.0f),
padding: EdgeInsets.all(12.0f),
child: new Text(text,
child: new Text(
text,
style: new TextStyle(
color: CupertinoColors.white,
fontSize: 13.0f,

public readonly string text;
public override Widget build(BuildContext context) {
bool isSelf = avatar == null;
bool isSelf = avatar == null;
new Tab2ConversationBubble(
text: text,
color: isSelf
? Tab2ConversationBubbleColor.blue
: Tab2ConversationBubbleColor.gray
new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,
child: new Tab2ConversationBubble(
text: text,
color: isSelf
? Tab2ConversationBubbleColor.blue
: Tab2ConversationBubbleColor.gray
)
)
);
return new SafeArea(
child: new Row(
mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end,
children: children
);
return new Row(
mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end,
children: children
);
}
}

trailing: CupertinoNavigationDemoUtils.trailingButtons
),
child: new SafeArea(
child: new DecoratedBox(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).brightness == Brightness.light
? CupertinoColors.extraLightBackgroundGray
: CupertinoColors.darkBackgroundGray
),
child: new ListView(
children: new List<Widget> {
new Padding(padding: EdgeInsets.only(top: 32.0f)),
new GestureDetector(
onTap: () => {
Navigator.of(context, rootNavigator: true).push(
new CupertinoPageRoute(
fullscreenDialog: true,
builder: (BuildContext _context) => new Tab3Dialog()
)
);
},
child: new Container(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
border: new Border(
top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f),
bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
)
),
height: 44.0f,
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
child: new SafeArea(
top: false,
bottom: false,
child: new Row(
children: new List<Widget> {
new Text(
"Sign in",
style: new TextStyle(color: CupertinoTheme.of(context)
.primaryColor)
),
}
)
child: new ListView(
children: new List<Widget> {
new Padding(padding: EdgeInsets.only(top: 32.0f)),
new GestureDetector(
onTap: () => {
Navigator.of(context, rootNavigator: true).push(
new CupertinoPageRoute(
fullscreenDialog: true,
builder: (BuildContext _context) => new Tab3Dialog()
)
);
},
child: new Container(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
border: new Border(
top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f),
bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
)
),
height: 44.0f,
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
child: new SafeArea(
top: false,
bottom: false,
child: new Row(
children: new List<Widget> {
new Text(
"Sign in",
style: new TextStyle(color: CupertinoTheme.of(context)
.primaryColor)
),
}
}
)
)
}
)
)
);

正在加载...
取消
保存