Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 67bd18c

Browse files
committed
[Cupertino] Fix bugs.
1 parent 919c773 commit 67bd18c

File tree

8 files changed

+639
-639
lines changed

8 files changed

+639
-639
lines changed

Runtime/cupertino/app.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ public CupertinoApp(
2727
List<Locale> supportedLocales = null,
2828
bool showPerformanceOverlay = false
2929
) : base(key: key) {
30-
// D.assert(routes != null);
31-
// D.assert(navigatorObservers != null);
32-
// D.assert(title != null);
33-
// D.assert(showPerformanceOverlay != null);
30+
D.assert(title != null);
3431

3532
supportedLocales = supportedLocales ?? new List<Locale> {new Locale("en", "US")};
3633
this.navigatorKey = navigatorKey;

Runtime/cupertino/bottom_app_bar.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public CupertinoTabBar(
3131
() => "Tabs need at least 2 items to conform to Apple's HIG"
3232
);
3333
D.assert(0 <= currentIndex && currentIndex < items.Count);
34-
D.assert(inactiveColor != null);
34+
35+
3536
this.items = items;
3637
this.onTap = onTap;
3738
this.currentIndex = currentIndex;
@@ -122,13 +123,14 @@ List<Widget> _buildTabItems(BuildContext context) {
122123

123124
for (int index = 0; index < this.items.Count; index += 1) {
124125
bool active = index == this.currentIndex;
126+
var tabIndex = index;
125127
result.Add(
126128
this._wrapActiveItem(
127129
context,
128130
new Expanded(
129131
child: new GestureDetector(
130132
behavior: HitTestBehavior.opaque,
131-
onTap: this.onTap == null ? null : (GestureTapCallback) (() => { this.onTap(index); }),
133+
onTap: this.onTap == null ? null : (GestureTapCallback) (() => { this.onTap(tabIndex); }),
132134
child: new Padding(
133135
padding: EdgeInsets.only(bottom: 4.0f),
134136
child: new Column(

Runtime/cupertino/slider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public override RenderObject createRenderObject(BuildContext context) {
150150
public override void updateRenderObject(BuildContext context, RenderObject _renderObject) {
151151
_RenderCupertinoSlider renderObject = _renderObject as _RenderCupertinoSlider;
152152
renderObject.value = this.value ?? 0.0f;
153-
renderObject.divisions = this.divisions ?? 0;
153+
renderObject.divisions = this.divisions;
154154
renderObject.activeColor = this.activeColor;
155155
renderObject.onChanged = this.onChanged;
156156
renderObject.onChangeStart = this.onChangeStart;

Runtime/cupertino/tab_scaffold.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class _CupertinoTabScaffoldState : State<CupertinoTabScaffold> {
4343
public override void initState() {
4444
base.initState();
4545
this._currentPage = this.widget.tabBar.currentIndex;
46+
4647
}
4748

4849
public override void didUpdateWidget(StatefulWidget _oldWidget) {
@@ -160,6 +161,9 @@ class _TabSwitchingViewState : State<_TabSwitchingView> {
160161
public override void initState() {
161162
base.initState();
162163
this.tabs = new List<Widget>(this.widget.tabNumber);
164+
for (int i = 0; i < this.widget.tabNumber; i++) {
165+
this.tabs.Add(null);
166+
}
163167
this.tabFocusNodes = Enumerable.Repeat(new FocusScopeNode(), this.widget.tabNumber).ToList();
164168
}
165169

@@ -191,8 +195,9 @@ public override Widget build(BuildContext context) {
191195
for (int index = 0; index < this.widget.tabNumber; index++) {
192196
bool active = index == this.widget.currentTabIndex;
193197

198+
var tabIndex = index;
194199
if (active || this.tabs[index] != null) {
195-
this.tabs[index] = this.widget.tabBuilder(context, index);
200+
this.tabs[index] = this.widget.tabBuilder(context, tabIndex);
196201
}
197202

198203
children.Add(new Offstage(

Samples/UIWidgetsGallery/demo/cupertino/cupertino_alert_demo.cs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -145,44 +145,44 @@ public override Widget build(BuildContext context) {
145145
}
146146
),
147147
// TODO: FIX BUG
148-
// new Padding(padding: EdgeInsets.all(8.0f)),
149-
// CupertinoButton.filled(
150-
// child: new Text("Action Sheet"),
151-
// padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
152-
// onPressed: () => {
153-
// this.showDemoActionSheet(
154-
// context: _context,
155-
// child: new CupertinoActionSheet(
156-
// title: new Text("Favorite Dessert"),
157-
// message: new Text(
158-
// "Please select the best dessert from the options below."),
159-
// actions: new List<Widget> {
160-
// new CupertinoActionSheetAction(
161-
// child: new Text("Profiteroles"),
162-
// onPressed: () => {
163-
// Navigator.pop(_context, "Profiteroles");
164-
// }
165-
// ),
166-
// new CupertinoActionSheetAction(
167-
// child: new Text("Cannolis"),
168-
// onPressed: () => {
169-
// Navigator.pop(_context, "Cannolis");
170-
// }
171-
// ),
172-
// new CupertinoActionSheetAction(
173-
// child: new Text("Trifle"),
174-
// onPressed: () => { Navigator.pop(_context, "Trifle"); }
175-
// )
176-
// },
177-
// cancelButton: new CupertinoActionSheetAction(
178-
// child: new Text("Cancel"),
179-
// isDefaultAction: true,
180-
// onPressed: () => { Navigator.pop(_context, "Cancel"); }
181-
// )
182-
// )
183-
// );
184-
// }
185-
// )
148+
new Padding(padding: EdgeInsets.all(8.0f)),
149+
CupertinoButton.filled(
150+
child: new Text("Action Sheet"),
151+
padding: EdgeInsets.symmetric(vertical: 16.0f, horizontal: 36.0f),
152+
onPressed: () => {
153+
this.showDemoActionSheet(
154+
context: _context,
155+
child: new CupertinoActionSheet(
156+
title: new Text("Favorite Dessert"),
157+
message: new Text(
158+
"Please select the best dessert from the options below."),
159+
actions: new List<Widget> {
160+
// new CupertinoActionSheetAction(
161+
// child: new Text("Profiteroles"),
162+
// onPressed: () => {
163+
// Navigator.pop(_context, "Profiteroles");
164+
// }
165+
// ),
166+
// new CupertinoActionSheetAction(
167+
// child: new Text("Cannolis"),
168+
// onPressed: () => {
169+
// Navigator.pop(_context, "Cannolis");
170+
// }
171+
// ),
172+
// new CupertinoActionSheetAction(
173+
// child: new Text("Trifle"),
174+
// onPressed: () => { Navigator.pop(_context, "Trifle"); }
175+
// )
176+
},
177+
cancelButton: new CupertinoActionSheetAction(
178+
child: new Text("Cancel"),
179+
isDefaultAction: true,
180+
onPressed: () => { Navigator.pop(_context, "Cancel"); }
181+
)
182+
)
183+
);
184+
}
185+
)
186186
}
187187
)
188188
};

0 commit comments

Comments
 (0)