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

Commit cb33133

Browse files
authored
Merge pull request #295 from IIzzaya/cupertinosample
[Cupertino] Navigation Bar
2 parents 906a84b + bf07a49 commit cb33133

File tree

4 files changed

+60
-61
lines changed

4 files changed

+60
-61
lines changed

Runtime/cupertino/nav_bar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ NavigatorState navigator
178178
public readonly NavigatorState navigator;
179179

180180
public override string ToString() {
181-
return "Default Hero tag for Cupertino navigation bars with navigator $navigator";
181+
return $"Default Hero tag for Cupertino navigation bars with navigator {this.navigator}";
182182
}
183183

184184
public bool Equals(_HeroTag other) {
@@ -1166,7 +1166,7 @@ public _TransitionableNavigationBar(
11661166
Widget child = null
11671167
) : base(key: componentsKeys.navBarBoxKey) {
11681168
D.assert(largeExpanded != null);
1169-
D.assert(!largeExpanded.Value || this.largeTitleTextStyle != null);
1169+
D.assert(!largeExpanded.Value || largeTitleTextStyle != null);
11701170

11711171
this.componentsKeys = componentsKeys;
11721172
this.backgroundColor = backgroundColor;

Runtime/widgets/heroes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public _HeroFlightManifest(
178178
HeroFlightShuttleBuilder shuttleBuilder,
179179
bool isUserGestureTransition
180180
) {
181-
D.assert(fromHero.widget.tag == toHero.widget.tag);
181+
D.assert(fromHero.widget.tag.ToString() == toHero.widget.tag.ToString());
182182
this.type = type;
183183
this.overlay = overlay;
184184
this.navigatorRect = navigatorRect;

Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace UIWidgetsGallery.gallery {
1515
class CupertinoNavigationDemoUtils {
16-
public const string _kGalleryAssetsPackage = "flutter_gallery_assets";
17-
1816
public const int _kChildCount = 50;
1917

2018
public static List<Color> coolColors = new List<Color> {
@@ -87,7 +85,6 @@ public static List<Widget> buildTab2Conversation() {
8785
}
8886
}
8987

90-
9188
public class CupertinoNavigationDemo : StatelessWidget {
9289
public CupertinoNavigationDemo() {
9390
this.colorItems = new List<Color>();
@@ -187,8 +184,8 @@ public CupertinoDemoTab1(
187184
List<Color> colorItems = null,
188185
List<string> colorNameItems = null
189186
) {
190-
this.colorItems = colorItems;
191-
this.colorNameItems = colorNameItems;
187+
this.colorItems = colorItems ?? new List<Color>();
188+
this.colorNameItems = colorNameItems ?? new List<string>();
192189
}
193190

194191
public readonly List<Color> colorItems;
@@ -354,7 +351,8 @@ public override void initState() {
354351
for (int i = 0; i < 10; i++) {
355352
this.relatedColors.Add(
356353
Color.fromARGB(
357-
255, this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
354+
255,
355+
this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
358356
this.widget.color.green + Random.Range(0, 50).clamp(0, 255),
359357
this.widget.color.blue + Random.Range(0, 50).clamp(0, 255)
360358
)
@@ -370,7 +368,6 @@ public override Widget build(BuildContext context) {
370368
trailing: new ExitButton()
371369
),
372370
child: new SafeArea(
373-
top: false,
374371
bottom: false,
375372
child: new ListView(
376373
children: new List<Widget> {
@@ -480,7 +477,7 @@ public override Widget build(BuildContext context) {
480477
);
481478
}
482479
)
483-
),
480+
)
484481
}
485482
)
486483
)
@@ -752,52 +749,54 @@ public override Widget build(BuildContext context) {
752749
navigationBar: new CupertinoNavigationBar(
753750
trailing: CupertinoNavigationDemoUtils.trailingButtons
754751
),
755-
child: new DecoratedBox(
756-
decoration: new BoxDecoration(
757-
color: CupertinoTheme.of(context).brightness == Brightness.light
758-
? CupertinoColors.extraLightBackgroundGray
759-
: CupertinoColors.darkBackgroundGray
760-
),
761-
child: new ListView(
762-
children: new List<Widget> {
763-
new Padding(padding: EdgeInsets.only(top: 32.0f)),
764-
new GestureDetector(
765-
onTap: () => {
766-
Navigator.of(context, rootNavigator: true).push(
767-
new CupertinoPageRoute(
768-
fullscreenDialog: true,
769-
builder: (BuildContext _context) => new Tab3Dialog()
770-
)
771-
);
772-
},
773-
child: new Container(
774-
decoration: new BoxDecoration(
775-
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
776-
border: new Border(
777-
top: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f),
778-
bottom: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f)
779-
)
780-
),
781-
height: 44.0f,
782-
child: new Padding(
783-
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
784-
child: new SafeArea(
785-
top: false,
786-
bottom: false,
787-
child: new Row(
788-
children: new List<Widget> {
789-
new Text(
790-
"Sign in",
791-
style: new TextStyle(color: CupertinoTheme.of(context)
792-
.primaryColor)
793-
),
794-
}
752+
child: new SafeArea(
753+
child: new DecoratedBox(
754+
decoration: new BoxDecoration(
755+
color: CupertinoTheme.of(context).brightness == Brightness.light
756+
? CupertinoColors.extraLightBackgroundGray
757+
: CupertinoColors.darkBackgroundGray
758+
),
759+
child: new ListView(
760+
children: new List<Widget> {
761+
new Padding(padding: EdgeInsets.only(top: 32.0f)),
762+
new GestureDetector(
763+
onTap: () => {
764+
Navigator.of(context, rootNavigator: true).push(
765+
new CupertinoPageRoute(
766+
fullscreenDialog: true,
767+
builder: (BuildContext _context) => new Tab3Dialog()
768+
)
769+
);
770+
},
771+
child: new Container(
772+
decoration: new BoxDecoration(
773+
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
774+
border: new Border(
775+
top: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f),
776+
bottom: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f)
777+
)
778+
),
779+
height: 44.0f,
780+
child: new Padding(
781+
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
782+
child: new SafeArea(
783+
top: false,
784+
bottom: false,
785+
child: new Row(
786+
children: new List<Widget> {
787+
new Text(
788+
"Sign in",
789+
style: new TextStyle(color: CupertinoTheme.of(context)
790+
.primaryColor)
791+
),
792+
}
793+
)
795794
)
796795
)
797796
)
798797
)
799-
)
800-
}
798+
}
799+
)
801800
)
802801
)
803802
);

Samples/UIWidgetsGallery/gallery/demos.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,14 @@ static List<GalleryDemo> _buildGalleryDemos() {
499499
documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html",
500500
buildRoute: (BuildContext context) => new CupertinoButtonsDemo()
501501
),
502-
// new GalleryDemo(
503-
// title: "Navigation",
504-
// icon: GalleryIcons.bottom_navigation,
505-
// category: _kCupertinoComponents,
506-
// routeName: CupertinoNavigationDemo.routeName,
507-
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html",
508-
// buildRoute: (BuildContext context) => new CupertinoNavigationDemo()
509-
// ),
502+
new GalleryDemo(
503+
title: "Navigation",
504+
icon: GalleryIcons.bottom_navigation,
505+
category: _kCupertinoComponents,
506+
routeName: CupertinoNavigationDemo.routeName,
507+
documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html",
508+
buildRoute: (BuildContext context) => new CupertinoNavigationDemo()
509+
),
510510
// new GalleryDemo(
511511
// title: "Pickers",
512512
// icon: GalleryIcons.@event,

0 commit comments

Comments
 (0)