public static void cancelBlockUser( bool isLoggedIn, VoidCallback pushToLogin, VoidCallback cancelBlockUserAction, VoidCallback mainRouterPop = null ) { if (!isLoggedIn) { pushToLogin(); return; } ActionSheetUtils.showModalActionSheet(new ActionSheet( title: "确定取消屏蔽该用户吗?", items: new List <ActionSheetItem> { new ActionSheetItem( "确定", type: ActionType.destructive, () => { cancelBlockUserAction(); mainRouterPop?.Invoke(); } ), new ActionSheetItem("取消", type: ActionType.cancel) } )); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); ButtonThemeData buttonTheme = ButtonTheme.of(context); return(new RawMaterialButton( onPressed: onPressed, onLongPress: () => onLongPress?.Invoke(), enableFeedback: enableFeedback ?? true, onHighlightChanged: onHighlightChanged, fillColor: buttonTheme.getFillColor(this), textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)), focusColor: focusColor ?? buttonTheme.getFocusColor(this) ?? theme.focusColor, hoverColor: hoverColor ?? buttonTheme.getHoverColor(this) ?? theme.hoverColor, highlightColor: highlightColor ?? theme.highlightColor, splashColor: splashColor ?? theme.splashColor, elevation: buttonTheme.getElevation(this), focusElevation: buttonTheme.getFocusElevation(this), hoverElevation: buttonTheme.getHoverElevation(this), highlightElevation: buttonTheme.getHighlightElevation(this), padding: buttonTheme.getPadding(this), visualDensity: visualDensity ?? theme.visualDensity, constraints: buttonTheme.getConstraints(this).copyWith( minWidth: minWidth, minHeight: height), shape: buttonTheme.getShape(this), clipBehavior: clipBehavior ?? Clip.none, focusNode: focusNode, autofocus: autofocus ?? false, animationDuration: buttonTheme.getAnimationDuration(this), child: child, materialTapTargetSize: materialTapTargetSize ?? theme.materialTapTargetSize)); }
public override Widget build(BuildContext context) { return(new Material( elevation: 16.0f, shape: new BeveledRectangleBorder( borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0f)) ), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => { onTap?.Invoke(); }, child: new Container( height: 40.0f, alignment: AlignmentDirectional.centerStart ) ), new Expanded( child: child ), } ) )); }
public override Widget build(BuildContext context) { return(new InkWell( onTap: () => onPressed?.Invoke(), child: new Padding( padding: padding ?? EdgeInsets.symmetric(vertical: 8.0f, horizontal: 24.0f), child: child ) )); }
public override void goBallistic(float velocity) { if (velocity == 0.0f || (velocity < 0.0f && listShouldScroll) || (velocity > 0.0f && extent.isAtMax)) { base.goBallistic(velocity); return; } _dragCancelCallback?.Invoke(); _dragCancelCallback = null; Simulation simulation = new ClampingScrollSimulation( position: extent.currentExtent, velocity: velocity, tolerance: physics.tolerance ); AnimationController ballisticController = AnimationController.unbounded( debugLabel: $"{GetType()}", vsync: context.vsync ); float lastDelta = 0; void _tick() { float delta = ballisticController.value - lastDelta; lastDelta = ballisticController.value; extent.addPixelDelta(delta, context.notificationContext); if ((velocity > 0 && extent.isAtMax) || (velocity < 0 && extent.isAtMin)) { velocity = ballisticController.velocity + (physics.tolerance.velocity * ballisticController.velocity.sign()); base.goBallistic(velocity); ballisticController.stop(); } else if (ballisticController.isCompleted) { base.goBallistic(0); } } ballisticController.addListener(_tick); ballisticController.animateWith(simulation).whenCompleteOrCancel( ballisticController.dispose ); }
public static Widget SettingValueUpDown(string title, string value, VoidCallback upPressed = null, VoidCallback downPressed = null) { return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container( child: new Text(title) ), new Expanded( child: new Row( mainAxisAlignment: Unity.UIWidgets.rendering.MainAxisAlignment.end, children: new List <Widget> { new Container( padding: EdgeInsets.symmetric(horizontal: 16f), child: new Text(value.ToString()) ), new Column( children: new List <Widget> { new Container( decoration: new BoxDecoration( border: new Border(bottom: new BorderSide(width: 0.1f, color: Colors.black26)) ), child: new InkWell( child: new Icon(Icons.arrow_drop_up, size: 18), onTap: () => { upPressed?.Invoke(); } ) //InkWell ), //Container new Container( decoration: new BoxDecoration( border: new Border(bottom: new BorderSide(width: 0.5f, color: Colors.white)) ), child: new InkWell( child: new Icon(Icons.arrow_drop_down, size: 18), onTap: () => { downPressed?.Invoke(); } ) //InkWell ) //Container } ), //column } //end children ) //row ) //expanded } //list ) //row )); }
public override Widget build(BuildContext context) { return(new SizedBox( child: new Column( mainAxisSize: MainAxisSize.min, children: new List <Widget> { new ListTile(title: new Text(Title), leading: new Icon(icon: IconData), onTap: () => { Callback?.Invoke(); }), new Divider(indent: 70, height: IsLast ? 0 : 16), } ) )); }
public static void showModalActionSheet( Widget child, Widget overlay = null, VoidCallback onPop = null ) { var route = new _ModalPopupRoute( builder: cxt => child, overlayBuilder: overlay == null ? (WidgetBuilder)null : ctx => overlay, barrierLabel: "Dismiss" ); Router.navigator.push(route: route).Then(_ => onPop?.Invoke()); }
public override Widget build(BuildContext context) { return(new InkWell( onTap: () => { mOnTap?.Invoke(); }, child: new Container( height: 40, child: new Row( children: new List <Widget>() { new SizedBox(width: 16), new Text(mText, style: new TextStyle(fontWeight: FontWeight.bold)) } ) ) )); }
public static void showCustomDialog( bool barrierDismissible = false, Color barrierColor = null, Widget child = null, VoidCallback onPop = null ) { var route = new _DialogRoute( (context, animation, secondaryAnimation) => new CustomSafeArea(child: child), barrierDismissible: barrierDismissible, barrierColor ?? Color.fromRGBO(0, 0, 0, 0.01f), new TimeSpan(0, 0, 0, 0, 150), transitionBuilder: _transitionBuilder ); Router.navigator.push(route: route).Then(_ => onPop?.Invoke()); }
public override Widget build(BuildContext context) { return(new Material( shape: new _DiamondBorder(), color: Colors.orange, child: new InkWell( onTap: () => onPressed?.Invoke(), child: new Container( width: 56.0f, height: 56.0f, child: IconTheme.merge( data: new IconThemeData(Theme.of(context).accentIconTheme.color), child: child ) ) ), elevation: 6.0f )); }
public static void showArticleShareView( bool showReportAndBlock, bool isLoggedIn, VoidCallback pushToCopy, VoidCallback pushToLogin, VoidCallback pushToBlock, VoidCallback pushToReport, OnShareType shareToWechat, VoidCallback mainRouterPop = null ) { ActionSheetUtils.showModalActionSheet(new ShareView( projectType: ProjectType.article, showReportAndBlock: showReportAndBlock, onPressed: type => { if (type == ShareType.clipBoard) { pushToCopy?.Invoke(); } else if (type == ShareType.block) { ReportManager.blockProject( isLoggedIn: isLoggedIn, pushToLogin: pushToLogin, pushToBlock: pushToBlock, mainRouterPop: mainRouterPop ); } else if (type == ShareType.report) { ReportManager.report( isLoggedIn: isLoggedIn, pushToLogin: pushToLogin, pushToReport: pushToReport ); } else { shareToWechat?.Invoke(type: type); } } )); }
public override Widget build(BuildContext buildContext) { return(new Scaffold( key: _scaffoldKey, backgroundColor: new Color(0xff000000), appBar: new AppBar( leading: new IconButton(color: Colors.white, icon: new Icon(icon: Icons.arrow_back_ios), splashColor: Colors.transparent, disableColor: Colors.transparent, highlightColor: Colors.transparent, onPressed: () => Navigator.pop(buildContext)), title: new Text("Edit Avatar", style: new TextStyle(color: Colors.white)), backgroundColor: new Color(0xff000000), centerTitle: true, actions: new List <Widget> { new Container( child: new FlatButton(child: new Text("···", style: new TextStyle(color: Colors.white)), onPressed: () => { _showBottomSheetCallback?.Invoke(); }) ) }), body: _buildAvatar() )); }
public override Widget build(BuildContext context) { return(new Container(decoration: new BoxDecoration(color: BackgroundColor), child: new Column( children: new List <Widget> { new ListTile(title: TitleWidget, trailing: TrailingWidget, onTap: () => OnTap?.Invoke()), new Divider(indent: DividerIndent, height: DividerHeight) } ) )); }
internal void _notifyRemoved() { onRemove?.Invoke(); }
public void Invoke() { callbacks?.Invoke(); }
public static Widget SettingValueUpDownButton(string title, string value, VoidCallback upPressed = null, VoidCallback downPressed = null, string upButtonText = "+", string downButtontext = "-") { return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container( child: new Text(title) ), new Expanded( child: new Row( mainAxisAlignment: Unity.UIWidgets.rendering.MainAxisAlignment.end, children: new List <Widget> { new Container( width: 40, child: new RaisedButton( padding: EdgeInsets.zero, child: new Text(downButtontext), color: Colors.white, shape: new CircleBorder( side: new BorderSide( color: Colors.grey, width: 1, style: BorderStyle.solid ) //BorderSide ), //CircleBorder onPressed: () => { downPressed?.Invoke(); } ) ), //RaisedButton new Container( padding: EdgeInsets.symmetric(horizontal: 16f), alignment: Alignment.center, child: new Text(value.ToString()) ), new Container( width: 40, child: new RaisedButton( padding: EdgeInsets.zero, child: new Text(upButtonText), color: Colors.white, shape: new CircleBorder( side: new BorderSide( color: Colors.grey, width: 1, style: BorderStyle.solid ) //BorderSide ), //CircleBorder onPressed: () => { upPressed?.Invoke(); } ) //RaisedButton ) //Container } ) //Container ) //Expand } //list ) //row )); }
Widget _buildHeadingCell( BuildContext context = null, EdgeInsetsGeometry padding = null, Widget label = null, string tooltip = null, bool?numeric = null, VoidCallback onSort = null, bool?sorted = null, bool?ascending = null ) { List <Widget> arrowWithPadding() { return(onSort == null ? new List <Widget>() : new List < Widget>() { new _SortArrow( visible: sorted, down: sorted ?? false ? ascending : null, duration: _sortArrowAnimationDuration ), new SizedBox(width: _sortArrowPadding) }); } var rowChild = new List <Widget>(); rowChild.Add(label); rowChild.AddRange(arrowWithPadding()); label = new Row( textDirection: numeric ?? false ? TextDirection.rtl : (TextDirection?)null, children: rowChild ); label = new Container( padding: padding, height: headingRowHeight, alignment: numeric ?? false ? Alignment.centerRight : (AlignmentGeometry)AlignmentDirectional.centerStart, child: new AnimatedDefaultTextStyle( style: new TextStyle( fontWeight: FontWeight.w500, fontSize: _headingFontSize, height: Mathf.Min(1.0f, headingRowHeight / _headingFontSize), color: (Theme.of(context).brightness == Brightness.light) ? ((onSort != null && (sorted ?? false)) ? Colors.black87 : Colors.black54) : ((onSort != null && (sorted ?? false)) ? Colors.white : Colors.white70) ), softWrap: false, duration: _sortArrowAnimationDuration, child: label ) ); if (tooltip != null) { label = new Tooltip( message: tooltip, child: label ); } // TODO(dkwingsmt): Only wrap Inkwell if onSort != null. Blocked by // https://github.com/flutter/flutter/issues/51152 label = new InkWell( onTap: () => onSort?.Invoke(), child: label ); return(label); }