BorderRadius _borderRadius(int index, bool start, bool end) { D.assert(MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topLeft == MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topRight); D.assert(MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topLeft == MaterialConstantsUtils.kMaterialEdges[MaterialType.card].bottomLeft); D.assert(MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topLeft == MaterialConstantsUtils.kMaterialEdges[MaterialType.card].bottomRight); Radius cardRadius = MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topLeft; Radius startRadius = Radius.zero; Radius endRadius = Radius.zero; if (index > 0 && this._children[index - 1] is MaterialGap) { startRadius = Radius.lerp( Radius.zero, cardRadius, this._animationTuples[this._children[index - 1].key].startAnimation.value); } if (index < this._children.Count - 2 && this._children[index + 1] is MaterialGap) { endRadius = Radius.lerp( Radius.zero, cardRadius, this._animationTuples[this._children[index + 1].key].endAnimation.value); } if (this.widget.mainAxis == Axis.vertical) { return(BorderRadius.vertical( top: start?cardRadius: startRadius, bottom: end ? cardRadius : endRadius)); } else { return(BorderRadius.horizontal( left: start?cardRadius: startRadius, right: end ? cardRadius : endRadius)); } }
public static Widget SettingHSVColorPicker( BuildContext context, string title, ValueChanged <Color> onColorChanged, Color color = null, string buttonName = "", bool enableAlpha = false, bool showPreviousColor = false ) { if (color == null) { color = Colors.blueAccent; } if (buttonName == "") { buttonName = color.ToHexString(enableAlpha); } 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 Container( padding: EdgeInsets.all(6), alignment: Alignment.bottomRight, child: new RaisedButton( color: color, child: new Text( buttonName, style: new TextStyle( color: Utils.useWhiteForeground(color) ? Colors.white : Colors.black ) //TextStyle ), //Text onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { if (showPreviousColor) { return new AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(25) ), //RoundedRectangleBorder content: new SingleChildScrollView( child: new SlidePicker( pickerColor: color, onColorChanged: onColorChanged, paletteType: PaletteType.hsv, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: false, showIndicator: true, indicatorBorderRadius: BorderRadius.vertical(top: Radius.circular(25)) ) //SlidePicker ) //SingleChildScrollView ); //AlertDialog } else { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new ColorPicker( pickerColor: color, onColorChanged: onColorChanged, colorPickerWidth: 300f, pickerAreaHeightPercent: 0.7f, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: true, paletteType: PaletteType.hsv, pickerAreaBorderRadius: BorderRadius.only( topLeft: Radius.circular(2f), topRight: Radius.circular(2f) ) //BorderRadius ) //ColorPicker ) //SingleChildScrollView ); //AlertDialog } } ); } ) ) //container ), //expanded } //list ) //row )); }
public override Widget build(BuildContext context) { return(new Theme( data: lightTheme?ThemeData.light() : ThemeData.dark(), child: new DefaultTabController( length: 3, child: new Scaffold( appBar: new AppBar( title: new GestureDetector( child: new Text("Color Picker Example"), onDoubleTap: (DoubleTapDetails details) => setState(() => lightTheme = !lightTheme) ),//GestureDetector bottom: new TabBar( tabs: new List <Widget> { new Tab(text: "HSV"), new Tab(text: "Material"), new Tab(text: "Block") } ) //TabBar ), //AppBar body: new TabBarView( physics: new NeverScrollableScrollPhysics(), children: new List <Widget> { new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new ColorPicker( pickerColor: currentColor, onColorChanged: changeColor, colorPickerWidth: 300f, pickerAreaHeightPercent: 0.7f, enableAlpha: true, displayThumbColor: true, showLabel: true, paletteType: PaletteType.hsv, pickerAreaBorderRadius: BorderRadius.only( topLeft: Radius.circular(2f), topRight: Radius.circular(2f) ) //BorderRadius ) //ColorPicker ) //SingleChildScrollView ); //AlertDialog } ); }, child: new Text("Change me"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ), //RaisedButton new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(25) ), //RoundedRectangleBorder content: new SingleChildScrollView( child: new SlidePicker( pickerColor: currentColor, onColorChanged: changeColor, paletteType: PaletteType.rgb, enableAlpha: false, displayThumbColor: true, showLabel: false, showIndicator: true, indicatorBorderRadius: BorderRadius.vertical(top: Radius.circular(25)) ) //SlidePicker ) //SingleChildScrollView ); //AlertDialog } ); }, child: new Text("Change me again"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) } ), //Column new Center( child: new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new MaterialPicker( pickerColor: currentColor, onColorChanged: changeColor, enableLabel: true ) //MaterialPicker ) //SingleChildScrollView ); //AlertDialog } ); //showDialog }, //onPresed child: new Text("Change me"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) //RaisedButton ), //Center new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( title: new Text("Select color"), content: new SingleChildScrollView( child: new BlockPicker( pickerColor: currentColor, onColorChanged: changeColor ) //BlockPicker ) //SingleChildScrollView ); //AlertDialog } ); //showDialog }, //onPressed child: new Text("Change me again"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) //RaisedButton } ) //Column ) //center } ) //TabBarView ) //Scaffold ) //DefaultTabController )); //Theme }//function build