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

Commit 0ec9896

Browse files
committed
[Cupertino] Navigation Bar
1 parent 906a84b commit 0ec9896

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
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;

Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs

Lines changed: 50 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;
@@ -349,12 +346,14 @@ public override State createState() {
349346
class Tab1ItemPageState : State<Tab1ItemPage> {
350347
public override void initState() {
351348
base.initState();
349+
this.relatedColors = new List<Color>(10);
352350

353351
this.relatedColors = new List<Color>();
354352
for (int i = 0; i < 10; i++) {
355353
this.relatedColors.Add(
356354
Color.fromARGB(
357-
255, this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
355+
255,
356+
this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
358357
this.widget.color.green + Random.Range(0, 50).clamp(0, 255),
359358
this.widget.color.blue + Random.Range(0, 50).clamp(0, 255)
360359
)
@@ -370,7 +369,6 @@ public override Widget build(BuildContext context) {
370369
trailing: new ExitButton()
371370
),
372371
child: new SafeArea(
373-
top: false,
374372
bottom: false,
375373
child: new ListView(
376374
children: new List<Widget> {
@@ -480,7 +478,7 @@ public override Widget build(BuildContext context) {
480478
);
481479
}
482480
)
483-
),
481+
)
484482
}
485483
)
486484
)
@@ -752,52 +750,54 @@ public override Widget build(BuildContext context) {
752750
navigationBar: new CupertinoNavigationBar(
753751
trailing: CupertinoNavigationDemoUtils.trailingButtons
754752
),
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-
}
753+
child: new SafeArea(
754+
child: new DecoratedBox(
755+
decoration: new BoxDecoration(
756+
color: CupertinoTheme.of(context).brightness == Brightness.light
757+
? CupertinoColors.extraLightBackgroundGray
758+
: CupertinoColors.darkBackgroundGray
759+
),
760+
child: new ListView(
761+
children: new List<Widget> {
762+
new Padding(padding: EdgeInsets.only(top: 32.0f)),
763+
new GestureDetector(
764+
onTap: () => {
765+
Navigator.of(context, rootNavigator: true).push(
766+
new CupertinoPageRoute(
767+
fullscreenDialog: true,
768+
builder: (BuildContext _context) => new Tab3Dialog()
769+
)
770+
);
771+
},
772+
child: new Container(
773+
decoration: new BoxDecoration(
774+
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
775+
border: new Border(
776+
top: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f),
777+
bottom: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f)
778+
)
779+
),
780+
height: 44.0f,
781+
child: new Padding(
782+
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
783+
child: new SafeArea(
784+
top: false,
785+
bottom: false,
786+
child: new Row(
787+
children: new List<Widget> {
788+
new Text(
789+
"Sign in",
790+
style: new TextStyle(color: CupertinoTheme.of(context)
791+
.primaryColor)
792+
),
793+
}
794+
)
795795
)
796796
)
797797
)
798798
)
799-
)
800-
}
799+
}
800+
)
801801
)
802802
)
803803
);

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)