浏览代码

Merge pull request #295 from IIzzaya/cupertinosample

[Cupertino] Navigation Bar
/main
GitHub 5 年前
当前提交
90fd7536
共有 4 个文件被更改,包括 60 次插入61 次删除
  1. 4
      Runtime/cupertino/nav_bar.cs
  2. 2
      Runtime/widgets/heroes.cs
  3. 99
      Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs
  4. 16
      Samples/UIWidgetsGallery/gallery/demos.cs

4
Runtime/cupertino/nav_bar.cs


public readonly NavigatorState navigator;
public override string ToString() {
return "Default Hero tag for Cupertino navigation bars with navigator $navigator";
return $"Default Hero tag for Cupertino navigation bars with navigator {this.navigator}";
}
public bool Equals(_HeroTag other) {

Widget child = null
) : base(key: componentsKeys.navBarBoxKey) {
D.assert(largeExpanded != null);
D.assert(!largeExpanded.Value || this.largeTitleTextStyle != null);
D.assert(!largeExpanded.Value || largeTitleTextStyle != null);
this.componentsKeys = componentsKeys;
this.backgroundColor = backgroundColor;

2
Runtime/widgets/heroes.cs


HeroFlightShuttleBuilder shuttleBuilder,
bool isUserGestureTransition
) {
D.assert(fromHero.widget.tag == toHero.widget.tag);
D.assert(fromHero.widget.tag.ToString() == toHero.widget.tag.ToString());
this.type = type;
this.overlay = overlay;
this.navigatorRect = navigatorRect;

99
Samples/UIWidgetsGallery/demo/cupertino/cupertino_navigation_demo.cs


namespace UIWidgetsGallery.gallery {
class CupertinoNavigationDemoUtils {
public const string _kGalleryAssetsPackage = "flutter_gallery_assets";
public const int _kChildCount = 50;
public static List<Color> coolColors = new List<Color> {

};
}
}
public class CupertinoNavigationDemo : StatelessWidget {
public CupertinoNavigationDemo() {

List<Color> colorItems = null,
List<string> colorNameItems = null
) {
this.colorItems = colorItems;
this.colorNameItems = colorNameItems;
this.colorItems = colorItems ?? new List<Color>();
this.colorNameItems = colorNameItems ?? new List<string>();
}
public readonly List<Color> colorItems;

for (int i = 0; i < 10; i++) {
this.relatedColors.Add(
Color.fromARGB(
255, this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
255,
this.widget.color.red + Random.Range(0, 50).clamp(0, 255),
this.widget.color.green + Random.Range(0, 50).clamp(0, 255),
this.widget.color.blue + Random.Range(0, 50).clamp(0, 255)
)

trailing: new ExitButton()
),
child: new SafeArea(
top: false,
bottom: false,
child: new ListView(
children: new List<Widget> {

);
}
)
),
)
}
)
)

navigationBar: new CupertinoNavigationBar(
trailing: CupertinoNavigationDemoUtils.trailingButtons
),
child: new DecoratedBox(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).brightness == Brightness.light
? CupertinoColors.extraLightBackgroundGray
: CupertinoColors.darkBackgroundGray
),
child: new ListView(
children: new List<Widget> {
new Padding(padding: EdgeInsets.only(top: 32.0f)),
new GestureDetector(
onTap: () => {
Navigator.of(context, rootNavigator: true).push(
new CupertinoPageRoute(
fullscreenDialog: true,
builder: (BuildContext _context) => new Tab3Dialog()
)
);
},
child: new Container(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
border: new Border(
top: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f),
bottom: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f)
)
),
height: 44.0f,
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
child: new SafeArea(
top: false,
bottom: false,
child: new Row(
children: new List<Widget> {
new Text(
"Sign in",
style: new TextStyle(color: CupertinoTheme.of(context)
.primaryColor)
),
}
child: new SafeArea(
child: new DecoratedBox(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).brightness == Brightness.light
? CupertinoColors.extraLightBackgroundGray
: CupertinoColors.darkBackgroundGray
),
child: new ListView(
children: new List<Widget> {
new Padding(padding: EdgeInsets.only(top: 32.0f)),
new GestureDetector(
onTap: () => {
Navigator.of(context, rootNavigator: true).push(
new CupertinoPageRoute(
fullscreenDialog: true,
builder: (BuildContext _context) => new Tab3Dialog()
)
);
},
child: new Container(
decoration: new BoxDecoration(
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
border: new Border(
top: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f),
bottom: new BorderSide(color: new Color(0xfBCBBC1), width: 0.0f)
)
),
height: 44.0f,
child: new Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
child: new SafeArea(
top: false,
bottom: false,
child: new Row(
children: new List<Widget> {
new Text(
"Sign in",
style: new TextStyle(color: CupertinoTheme.of(context)
.primaryColor)
),
}
)
)
}
}
)
)
)
);

16
Samples/UIWidgetsGallery/gallery/demos.cs


documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoButton-class.html",
buildRoute: (BuildContext context) => new CupertinoButtonsDemo()
),
// new GalleryDemo(
// title: "Navigation",
// icon: GalleryIcons.bottom_navigation,
// category: _kCupertinoComponents,
// routeName: CupertinoNavigationDemo.routeName,
// documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html",
// buildRoute: (BuildContext context) => new CupertinoNavigationDemo()
// ),
new GalleryDemo(
title: "Navigation",
icon: GalleryIcons.bottom_navigation,
category: _kCupertinoComponents,
routeName: CupertinoNavigationDemo.routeName,
documentationUrl: "https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html",
buildRoute: (BuildContext context) => new CupertinoNavigationDemo()
),
// new GalleryDemo(
// title: "Pickers",
// icon: GalleryIcons.@event,

正在加载...
取消
保存