浏览代码

add all ok material samples

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
1bad4f76
共有 12 个文件被更改,包括 535 次插入0 次删除
  1. 56
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs
  2. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta
  3. 86
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs
  4. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta
  5. 61
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs
  6. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta
  7. 131
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs
  8. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta
  9. 82
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs
  10. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta
  11. 53
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs
  12. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta

56
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs


using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Material = Unity.UIWidgets.material.Material;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialInkWellSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialInkWellWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialInkWellWidget : StatefulWidget {
public MaterialInkWellWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialInkWidgetState();
}
}
public class MaterialInkWidgetState : State<MaterialInkWellWidget> {
public override Widget build(BuildContext context) {
return new Material(
//color: Colors.blue,
child: new Center(
child: new Container(
width: 200,
height: 200,
child: new InkWell(
borderRadius: BorderRadius.circular(2.0f),
highlightColor: new Color(0xAAFF0000),
splashColor: new Color(0xAA0000FF),
onTap: () => { Debug.Log("on tap"); }
)
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta


fileFormatVersion: 2
guid: b9e88c33e9f304d40bab9c27f1276033
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

86
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialNavigationBarSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialNavigationBarWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
class MaterialNavigationBarWidget : StatefulWidget {
public MaterialNavigationBarWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialNavigationBarWidgetState();
}
}
class MaterialNavigationBarWidgetState : SingleTickerProviderStateMixin<MaterialNavigationBarWidget> {
int _currentIndex = 0;
public MaterialNavigationBarWidgetState() {
}
public override Widget build(BuildContext context) {
return new Scaffold(
bottomNavigationBar: new Container(
height: 100,
color: Colors.blue,
child: new Center(
child: new BottomNavigationBar(
type: BottomNavigationBarType.shifting,
// type: BottomNavigationBarType.fix,
items: new List<BottomNavigationBarItem> {
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 30),
title: new Text("Work"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 30),
title: new Text("Home"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 30),
title: new Text("Shop"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 30),
title: new Text("School"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 50),
backgroundColor: Colors.blue
),
},
currentIndex: this._currentIndex,
onTap: (value) => { this.setState(() => { this._currentIndex = value; }); }
)
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta


fileFormatVersion: 2
guid: cc34344049d222b468f2487b97076448
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

61
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialSliderSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new MaterialSliderWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialSliderWidget : StatefulWidget {
public override State createState() {
return new MaterialSliderState();
}
}
public class MaterialSliderState : State<MaterialSliderWidget> {
float _value = 0.8f;
void onChanged(float value) {
this.setState(() => { this._value = value; });
}
public override Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Slider and Indicators")),
body: new Column(
children: new List<Widget> {
new Padding(
padding: EdgeInsets.only(top: 100.0f),
child: new Container(
child: new Slider(
divisions: 10,
min: 0.4f,
label: "Here",
value: this._value,
onChanged: this.onChanged))
)
}
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta


fileFormatVersion: 2
guid: 0152b6f575e6ca44baea965a23ebe498
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

131
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialTabBarSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new TabBarDemo()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class TabBarDemo : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new MaterialTabBarWidget();
/*
return new DefaultTabController(
length: 3,
child: new Scaffold(
appBar: new AppBar(
bottom: new TabBar(
tabs: new List<Widget> {
new Tab(icon: new Icon(Icons.directions_car)),
new Tab(icon: new Icon(Icons.directions_transit)),
new Tab(icon: new Icon(Icons.directions_bike)),
}
),
title: new Text("Tabs Demo")
),
body: new TabBarView(
children: new List<Widget> {
new Icon(Icons.directions_car),
new Icon(Icons.directions_transit),
new Icon(Icons.directions_bike),
}
)
)
);*/
}
}
public class MaterialTabBarWidget : StatefulWidget {
public MaterialTabBarWidget(Key key = null) : base(key) {
}
public override State createState() {
return new MaterialTabBarWidgetState();
}
}
public class MaterialTabBarWidgetState : SingleTickerProviderStateMixin<MaterialTabBarWidget> {
TabController _tabController;
public override void initState() {
base.initState();
this._tabController = new TabController(vsync: this, length: Choice.choices.Count);
}
public override void dispose() {
this._tabController.dispose();
base.dispose();
}
void _nextPage(int delta) {
int newIndex = this._tabController.index + delta;
if (newIndex < 0 || newIndex >= this._tabController.length) {
return;
}
this._tabController.animateTo(newIndex);
}
public override Widget build(BuildContext context) {
List<Widget> tapChildren = new List<Widget>();
foreach (Choice choice in Choice.choices) {
tapChildren.Add(
new Padding(
padding: EdgeInsets.all(16.0f),
child: new ChoiceCard(choice: choice)));
}
return new Scaffold(
appBar: new AppBar(
title: new Center(
child: new Text("AppBar Bottom Widget")
),
leading: new IconButton(
tooltip: "Previous choice",
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_back),
onPressed: () => { this._nextPage(-1); }
),
actions: new List<Widget> {
new IconButton(
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_forward),
tooltip: "Next choice",
onPressed: () => { this._nextPage(1); })
},
bottom: new PreferredSize(
preferredSize: Size.fromHeight(48.0f),
child: new Theme(
data: Theme.of(context).copyWith(accentColor: Colors.white),
child: new Container(
height: 48.0f,
alignment: Alignment.center,
child: new TabPageSelector(
controller: this._tabController))))
),
body: new TabBarView(
controller: this._tabController,
children: tapChildren
));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta


fileFormatVersion: 2
guid: fecd06f805d0b0f4ead134b1ad6a9a49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

82
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Image = Unity.UIWidgets.widgets.Image;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class MaterialThemeSample: UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
home: new MaterialThemeSampleWidget(),
darkTheme: new ThemeData(primaryColor: Colors.black26)
));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class MaterialThemeSampleWidget: StatefulWidget {
public override State createState() {
return new _MaterialThemeSampleWidgetState();
}
}
class _MaterialThemeSampleWidgetState : State<MaterialThemeSampleWidget> {
public override Widget build(BuildContext context) {
return new Theme(
data: new ThemeData(
appBarTheme: new AppBarTheme(
color: Colors.purple
),
bottomAppBarTheme: new BottomAppBarTheme(
color: Colors.blue
),
cardTheme: new CardTheme(
color: Colors.red,
elevation: 2.0f
)
),
child: new Scaffold(
appBar: new AppBar(title: new Text("Test App Bar Theme")),
body: new Center(
child: new Card(
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.all(5.0f)
),
child: new Container(
height: 250,
child: new Column(
children: new List<Widget> {
new Text("Card Theme")
}
)
)
)
),
bottomNavigationBar: new BottomAppBar(
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget> {
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }),
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), onPressed: () => { })
})
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta


fileFormatVersion: 2
guid: b2a39cf0b83823749a13aebaf25cfb1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample {
public class TableSample : UIWidgetsPanel {
protected override void main() {
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new TableWidget()));
}
protected new void OnEnable() {
base.OnEnable();
}
}
public class TableWidget : StatelessWidget {
public TableWidget(Key key = null) : base(key) {
}
public override Widget build(BuildContext context) {
return new Scaffold(
body: new Table(
children: new List<TableRow> {
new TableRow(
decoration: new BoxDecoration(color: Colors.blue),
children: new List<Widget> {
new Text("item 1"),
new Text("item 2")
}
),
new TableRow(children: new List<Widget> {
new Text("item 3"),
new Text("item 4")
}
)
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta


fileFormatVersion: 2
guid: 1cba65c03fbf50f4cac974273a7c9445
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存