13
13
14
14
namespace UIWidgetsGallery . gallery {
15
15
class CupertinoNavigationDemoUtils {
16
- public const string _kGalleryAssetsPackage = "flutter_gallery_assets" ;
17
-
18
16
public const int _kChildCount = 50 ;
19
17
20
18
public static List < Color > coolColors = new List < Color > {
@@ -87,7 +85,6 @@ public static List<Widget> buildTab2Conversation() {
87
85
}
88
86
}
89
87
90
-
91
88
public class CupertinoNavigationDemo : StatelessWidget {
92
89
public CupertinoNavigationDemo ( ) {
93
90
this . colorItems = new List < Color > ( ) ;
@@ -187,8 +184,8 @@ public CupertinoDemoTab1(
187
184
List < Color > colorItems = null ,
188
185
List < string > colorNameItems = null
189
186
) {
190
- this . colorItems = colorItems ;
191
- this . colorNameItems = colorNameItems ;
187
+ this . colorItems = colorItems ?? new List < Color > ( ) ;
188
+ this . colorNameItems = colorNameItems ?? new List < string > ( ) ;
192
189
}
193
190
194
191
public readonly List < Color > colorItems ;
@@ -349,12 +346,14 @@ public override State createState() {
349
346
class Tab1ItemPageState : State < Tab1ItemPage > {
350
347
public override void initState ( ) {
351
348
base . initState ( ) ;
349
+ this . relatedColors = new List < Color > ( 10 ) ;
352
350
353
351
this . relatedColors = new List < Color > ( ) ;
354
352
for ( int i = 0 ; i < 10 ; i ++ ) {
355
353
this . relatedColors . Add (
356
354
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 ) ,
358
357
this . widget . color . green + Random . Range ( 0 , 50 ) . clamp ( 0 , 255 ) ,
359
358
this . widget . color . blue + Random . Range ( 0 , 50 ) . clamp ( 0 , 255 )
360
359
)
@@ -370,7 +369,6 @@ public override Widget build(BuildContext context) {
370
369
trailing : new ExitButton ( )
371
370
) ,
372
371
child : new SafeArea (
373
- top : false ,
374
372
bottom : false ,
375
373
child : new ListView (
376
374
children : new List < Widget > {
@@ -480,7 +478,7 @@ public override Widget build(BuildContext context) {
480
478
) ;
481
479
}
482
480
)
483
- ) ,
481
+ )
484
482
}
485
483
)
486
484
)
@@ -752,52 +750,54 @@ public override Widget build(BuildContext context) {
752
750
navigationBar : new CupertinoNavigationBar (
753
751
trailing : CupertinoNavigationDemoUtils . trailingButtons
754
752
) ,
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
+ )
795
795
)
796
796
)
797
797
)
798
798
)
799
- )
800
- }
799
+ }
800
+ )
801
801
)
802
802
)
803
803
) ;
0 commit comments