浏览代码

[Cupertino] Fix bugs.

/main
iizzaya 5 年前
当前提交
01b02f52
共有 8 个文件被更改,包括 561 次插入557 次删除
  1. 5
      Runtime/cupertino/app.cs
  2. 6
      Runtime/cupertino/bottom_app_bar.cs
  3. 2
      Runtime/cupertino/slider.cs
  4. 7
      Runtime/cupertino/tab_scaffold.cs
  5. 76
      Samples/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs
  6. 989
      Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs
  7. 29
      Samples/UIWidgetsGallery/demo/cupertino/cupertino_slider_demo.cs
  8. 4
      Samples/UIWidgetsGallery/gallery/demos.cs

5
Runtime/cupertino/app.cs


List<Locale> supportedLocales = null,
bool showPerformanceOverlay = false
) : base(key: key) {
// D.assert(routes != null);
// D.assert(navigatorObservers != null);
// D.assert(title != null);
// D.assert(showPerformanceOverlay != null);
D.assert(title != null);
supportedLocales = supportedLocales ?? new List<Locale> {new Locale("en", "US")};
this.navigatorKey = navigatorKey;

6
Runtime/cupertino/bottom_app_bar.cs


() => "Tabs need at least 2 items to conform to Apple's HIG"
);
D.assert(0 <= currentIndex && currentIndex < items.Count);
D.assert(inactiveColor != null);
this.items = items;
this.onTap = onTap;
this.currentIndex = currentIndex;

for (int index = 0; index < this.items.Count; index += 1) {
bool active = index == this.currentIndex;
var tabIndex = index;
result.Add(
this._wrapActiveItem(
context,

onTap: this.onTap == null ? null : (GestureTapCallback) (() => { this.onTap(index); }),
onTap: this.onTap == null ? null : (GestureTapCallback) (() => { this.onTap(tabIndex); }),
child: new Padding(
padding: EdgeInsets.only(bottom: 4.0f),
child: new Column(

2
Runtime/cupertino/slider.cs


public override void updateRenderObject(BuildContext context, RenderObject _renderObject) {
_RenderCupertinoSlider renderObject = _renderObject as _RenderCupertinoSlider;
renderObject.value = this.value ?? 0.0f;
renderObject.divisions = this.divisions ?? 0;
renderObject.divisions = this.divisions;
renderObject.activeColor = this.activeColor;
renderObject.onChanged = this.onChanged;
renderObject.onChangeStart = this.onChangeStart;

7
Runtime/cupertino/tab_scaffold.cs


public override void initState() {
base.initState();
this._currentPage = this.widget.tabBar.currentIndex;
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {

public override void initState() {
base.initState();
this.tabs = new List<Widget>(this.widget.tabNumber);
for (int i = 0; i < this.widget.tabNumber; i++) {
this.tabs.Add(null);
}
this.tabFocusNodes = Enumerable.Repeat(new FocusScopeNode(), this.widget.tabNumber).ToList();
}

for (int index = 0; index < this.widget.tabNumber; index++) {
bool active = index == this.widget.currentTabIndex;
var tabIndex = index;
this.tabs[index] = this.widget.tabBuilder(context, index);
this.tabs[index] = this.widget.tabBuilder(context, tabIndex);
}
children.Add(new Offstage(

76
Samples/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs


}
),
// TODO: FIX BUG
// new Padding(padding: EdgeInsets.all(8.0f)),
// CupertinoButton.filled(
// child: new Text("Action Sheet"),
// padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
// onPressed: () => {
// this.showDemoActionSheet(
// context: _context,
// child: new CupertinoActionSheet(
// title: new Text("Favorite Dessert"),
// message: new Text(
// "Please select the best dessert from the options below."),
// actions: new List<Widget> {
// new CupertinoActionSheetAction(
// child: new Text("Profiteroles"),
// onPressed: () => {
// Navigator.pop(_context, "Profiteroles");
// }
// ),
// new CupertinoActionSheetAction(
// child: new Text("Cannolis"),
// onPressed: () => {
// Navigator.pop(_context, "Cannolis");
// }
// ),
// new CupertinoActionSheetAction(
// child: new Text("Trifle"),
// onPressed: () => { Navigator.pop(_context, "Trifle"); }
// )
// },
// cancelButton: new CupertinoActionSheetAction(
// child: new Text("Cancel"),
// isDefaultAction: true,
// onPressed: () => { Navigator.pop(_context, "Cancel"); }
// )
// )
// );
// }
// )
new Padding(padding: EdgeInsets.all(8.0f)),
CupertinoButton.filled(
child: new Text("Action Sheet"),
padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
onPressed: () => {
this.showDemoActionSheet(
context: _context,
child: new CupertinoActionSheet(
title: new Text("Favorite Dessert"),
message: new Text(
"Please select the best dessert from the options below."),
actions: new List<Widget> {
// new CupertinoActionSheetAction(
// child: new Text("Profiteroles"),
// onPressed: () => {
// Navigator.pop(_context, "Profiteroles");
// }
// ),
// new CupertinoActionSheetAction(
// child: new Text("Cannolis"),
// onPressed: () => {
// Navigator.pop(_context, "Cannolis");
// }
// ),
// new CupertinoActionSheetAction(
// child: new Text("Trifle"),
// onPressed: () => { Navigator.pop(_context, "Trifle"); }
// )
},
cancelButton: new CupertinoActionSheetAction(
child: new Text("Cancel"),
isDefaultAction: true,
onPressed: () => { Navigator.pop(_context, "Cancel"); }
)
)
);
}
)
}
)
};

989
Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs
文件差异内容过多而无法显示
查看文件

29
Samples/UIWidgetsGallery/demo/cupertino/cupertino_slider_demo.cs


child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: new List<Widget> {
// TODO: FIX BUG
// new Column(
// mainAxisSize: MainAxisSize.min,
// children: new List<Widget> {
// new CupertinoSlider(
// value: this._value,
// min: 0.0f,
// max: 100.0f,
// onChanged: (float value) => {
// this.setState(() => { this._value = value; });
// }
// ),
// new Text($"Cupertino Continuous: {this._value.ToString("F1")}"),
// }
// ),
new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
new CupertinoSlider(
value: this._value,
min: 0.0f,
max: 100.0f,
onChanged: (float value) => {
this.setState(() => { this._value = value; });
}
),
new Text($"Cupertino Continuous: {this._value.ToString("F1")}"),
}
),
new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {

4
Samples/UIWidgetsGallery/gallery/demos.cs


// new GalleryDemo(
// title: "Navigation",
// icon: GalleryIcons.bottom_navigation,
// category: GalleryDemoCategory._kCupertinoComponents,
// category: _kCupertinoComponents,
// buildRoute: (BuildContext context) => CupertinoNavigationDemo()
// buildRoute: (BuildContext context) => new CupertinoNavigationDemo()
// ),
// new GalleryDemo(
// title: "Pickers",

正在加载...
取消
保存