예제 #1
0
        string _getRouteLabel(MaterialLocalizations localizations)
        {
            switch (Theme.of(context).platform)
            {
            case RuntimePlatform.IPhonePlayer:
            case RuntimePlatform.OSXEditor:
            case RuntimePlatform.OSXPlayer:
                return("");

            case RuntimePlatform.Android:
            case RuntimePlatform.LinuxEditor:
            case RuntimePlatform.LinuxPlayer:
            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.WindowsPlayer:
                return(localizations.dialogLabel);
            }

            return(null);
        }
예제 #2
0
        public override Widget build(BuildContext context)
        {
            D.assert(WidgetsD.debugCheckHasMediaQuery(context));
            D.assert(material_.debugCheckHasMaterialLocalizations(context));
            MediaQueryData        mediaQuery    = MediaQuery.of(context);
            MaterialLocalizations localizations = MaterialLocalizations.of(context);
            string routeLabel = _getRouteLabel(localizations);

            return(new AnimatedBuilder(
                       animation: widget.route.animation,
                       builder: (BuildContext _context, Widget child) => {
                float animationValue = animationCurve.transform(
                    mediaQuery.accessibleNavigation ? 1.0f : widget.route.animation.value
                    );
                return new ClipRect(
                    child: new CustomSingleChildLayout(
                        layoutDelegate: new _ModalBottomSheetLayout(animationValue, widget.isScrollControlled),
                        child: new BottomSheet(
                            animationController: widget.route._animationController,
                            onClosing: () => {
                    if (widget.route.isCurrent)
                    {
                        Navigator.pop <object>(_context);
                    }
                },
                            builder: widget.route.builder,
                            backgroundColor: widget.backgroundColor,
                            elevation: widget.elevation,
                            shape: widget.shape,
                            clipBehavior: widget.clipBehavior,
                            enableDrag: widget.enableDrag,
                            onDragStart: handleDragStart,
                            onDragEnd: handleDragEnd
                            )
                        )
                    );
            }
                       ));
        }
예제 #3
0
 public override Widget build(BuildContext context)
 {
     return(new Scaffold(
                appBar: new AppBar(
                    elevation: 0.0f,
                    backgroundColor: Colors.white,
                    brightness: Brightness.light,
                    leading: new IconButton(
                        icon: new BackButtonIcon(),
                        tooltip: MaterialLocalizations.of(context).backButtonTooltip,
                        onPressed: () => {
         Navigator.of(context, rootNavigator: true).pop <object>();
     }
                        )
                    ),
                body: new SafeArea(
                    child: new ListView(
                        padding: EdgeInsets.symmetric(horizontal: 24.0f),
                        children: new List <Widget> {
         new SizedBox(height: 80.0f),
         new Column(
             children: new List <Widget>
         {
             Image.file("shrine_images/diamond.png"),
             new SizedBox(height: 16.0f),
             new Text(
                 "SHRINE",
                 style: Theme.of(context).textTheme.headline5
                 ),
         }
             ),
         new SizedBox(height: 120.0f),
         new PrimaryColorOverride(
             color: shrineColorsUtils.kShrineBrown900,
             child: new Container(
                 decoration: _decoration,
                 child: new TextField(
                     controller: _usernameController,
                     decoration: new InputDecoration(
                         labelText: "Username"
                         )
                     )
                 )
             ),
         new SizedBox(height: 12.0f),
         new PrimaryColorOverride(
             color: shrineColorsUtils.kShrineBrown900,
             child: new Container(
                 decoration: _decoration,
                 child: new TextField(
                     controller: _passwordController,
                     decoration: new InputDecoration(
                         labelText: "Password"
                         )
                     )
                 )
             ),
         new Wrap(
             children: new List <Widget> {
             new ButtonBar(
                 children: new List <Widget> {
                 new FlatButton(
                     child: new Text("CANCEL"),
                     shape: new BeveledRectangleBorder(
                         borderRadius: BorderRadius.all(Radius.circular(7.0f))
                         ),
                     onPressed: () => {
                     Navigator.of(context, rootNavigator: true).pop <object>();
                 }
                     ),
                 new RaisedButton(
                     child: new Text("NEXT"),
                     elevation: 8.0f,
                     shape: new BeveledRectangleBorder(
                         borderRadius: BorderRadius.all(Radius.circular(7.0f))
                         ),
                     onPressed: () => {
                     Navigator.pop(context);
                 }
                     )
             }
                 ),
         }
             ),
     }
                        )
                    )
                ));
 }
예제 #4
0
        List <Widget> _createTiles()
        {
            MaterialLocalizations localizations = MaterialLocalizations.of(this.context);

            D.assert(localizations != null);
            List <Widget> children = new List <Widget> {
            };

            switch (this.widget.type)
            {
            case BottomNavigationBarType.fix:
                ThemeData themeData = Theme.of(this.context);
                TextTheme textTheme = themeData.textTheme;
                Color     themeColor;
                switch (themeData.brightness)
                {
                case Brightness.light:
                    themeColor = themeData.primaryColor;
                    break;

                case Brightness.dark:
                    themeColor = themeData.accentColor;
                    break;

                default:
                    throw new Exception("Unknown brightness: " + themeData.brightness);
                }

                ColorTween colorTween = new ColorTween(
                    begin: textTheme.caption.color,
                    end: this.widget.fixedColor ?? themeColor
                    );
                for (int i = 0; i < this.widget.items.Count; i += 1)
                {
                    int index = i;
                    children.Add(
                        new _CustomBottomNavigationTile(this.widget.type, this.widget.items[i], this._animations[i],
                                                        this.widget.iconSize,
                                                        onTap: () =>
                    {
                        if (this.widget.onTap != null)
                        {
                            this.widget.onTap(index);
                        }
                    },
                                                        colorTween: colorTween,
                                                        selected: i == this.widget.currentIndex,
                                                        indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
                                                        )
                        );
                }

                break;

            case BottomNavigationBarType.shifting:
                for (int i = 0; i < this.widget.items.Count; i += 1)
                {
                    int index = i;
                    children.Add(
                        new _CustomBottomNavigationTile(this.widget.type, this.widget.items[i], this._animations[i],
                                                        this.widget.iconSize,
                                                        onTap: () =>
                    {
                        if (this.widget.onTap != null)
                        {
                            this.widget.onTap(index);
                        }
                    },
                                                        flex:
                                                        this._evaluateFlex(this._animations[i]),
                                                        selected: i == this.widget.currentIndex,
                                                        indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
                                                        )
                        );
                }

                break;
            }

            return(children);
        }