Use it in [showDialog] widget: // create some valuesColor pickerColor = Color(0xff443a49); Color currentColor = Color(0xff443a49);// ValueChanged<Color> callbackvoidchangeColor(Color color) { setState(() => pickerColor = color); }// raise the [showDialog] widgetshowDialog( context: ...
('Color Picker Demo'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ ColorSwatch( color: _pickedColor, borderColor: Colors.black, borderWidth: 2.0, radius: 24.0, ), SizedBox(height: 16.0), ElevatedButton( onPressed: () => _...
/// Use Block color picker:/// child: BlockPicker(// pickerColor: currentColor,// onColorChanged: changeColor,// ),/// child: MultipleChoiceBlockPicker(// pickerColors: currentColors,// onColorsChanged: changeColors,// ),), actions:<Widget>[ElevatedButton( child:constText('Got it'), ...
pub.dartlang.org/packages/fl…默认情况下,Flutter是没有提供显示Html的组件的,所以如果要显示Html,需要使用三方的包,这个包可以将html呈现给原生的Widget。类似于Android的jsoup插件。 flutter_html_textview pub.dartlang.org/packages/fl…将html呈现为一个Widget,在textview中呈现html。 MarkDown flutter_markdown...
import'package:flutter/material.dart';import'package:gender_picker/gender_picker.dart';import'package:gender_picker/source/enums.dart';voidmain() { runApp(MyApp()); }classMyAppextendsStatelessWidget { @override Widget build(BuildContext context) {returnMaterialApp( ...
flutter_colorpicker 一款受chrome devtools启发的HSV(HSB)/ HSL拾色器。 2021-12-12 591 flutter_unity_widget Flutter Unity 3D小部件,用于将Unity游戏场景嵌入flutter中。 2022-09-01 594 flame Flutter游戏引擎。 2022-10-01 1159 logger 小型,易于使用且可扩展的记录器,可打印精美的日志。 2021-08-26 1794...
这里colorList用于存放颜色,themeIndex使用SharedPreferences存放颜色索引,单独定义isDark变量用于判断当前是否是暗黑模式。 使用Provider注入Global 接下来在main.dart中注入全局变量,部分代码如下: runApp(RestartWidget(child: MultiProvider(providers: [Provider<Global>(create: (_) => Global(prefs),),],child: MyApp...
simple_animations_stateless_widget 提供了简单动画的状态控件支持,可以方便地实现动画效果管理。 pie_chart 提供了饼状图的支持,可以方便地在应用中显示闪存用量、存储空间等信息。 vibrate 提供了设备振动的支持,可以方便地控制设备振动状态。 url_launcher_windows ...
final TimeOfDay time = await showTimePicker( context: context, initialTime: selectedTime, ); if (time == null) return; setState(() { selectedTime = time; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( ...
import'dart:ui';import'package:flutter/material.dart';import'package:flutter_colorpicker/flutter_colorpicker.dart';voidmain()=>runApp(constMyApp());classMyAppextendsStatelessWidget{constMyApp({super.key});@overrideWidgetbuild(BuildContextcontext) {returnconstMaterialApp(home:DrawingBoard(),);}}///...