flutter-widget

I need to customize the switch button in flutter

蹲街弑〆低调 提交于 2020-03-15 15:04:40
问题 this is flutter switch button: - I want this design: - 回答1: You can use package https://pub.dev/packages/custom_switch or fork it and modify to your full code import 'package:custom_switch/custom_switch.dart'; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.deepOrange ), home: HomeScreen(), )

I need to customize the switch button in flutter

拟墨画扇 提交于 2020-03-15 14:54:32
问题 this is flutter switch button: - I want this design: - 回答1: You can use package https://pub.dev/packages/custom_switch or fork it and modify to your full code import 'package:custom_switch/custom_switch.dart'; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.deepOrange ), home: HomeScreen(), )

passing generic type by Function(T) in flutter

自闭症网瘾萝莉.ら 提交于 2020-02-24 05:49:06
问题 I'm trying to create a generic consumer widget that facilitates the ViewModel to its child. therefor I have two functions. one that has a function(T) after init of the ViewModel and the other for passing the model to its child Widget. in the generic class is a child of ChangeNotifier and that works fine until I want to send the T value in the two Functions. then I get the following errors: type '(OnBoardingViewModel) => Null' is not a subtype of type '(ChangeNotifier) => void' and type '

Flutter/dart capture entire partially OFFSCREEN widget as image

与世无争的帅哥 提交于 2019-12-02 10:09:41
问题 Some comments on this answer suggest that it is possible to capture every pixel of a widget, even if it is partially offscreen. Comments in this answer suggest the opposite. I haven't been able to figure it out, I've only started messing with it today. Here's the code I have so far: RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject(); ui.Image image = await boundary.toImage(); ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List

Flutter/dart capture entire partially OFFSCREEN widget as image

╄→гoц情女王★ 提交于 2019-12-02 09:16:39
Some comments on this answer suggest that it is possible to capture every pixel of a widget, even if it is partially offscreen. Comments in this answer suggest the opposite. I haven't been able to figure it out, I've only started messing with it today. Here's the code I have so far: RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject(); ui.Image image = await boundary.toImage(); ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List pngBytes = byteData.buffer.asUint8List(); Anyone know how to modify this so it will capture the full widget?