dart

How to add custom Strikethrough to Text Widget in Flutter

戏子无情 提交于 2021-01-21 11:17:38
问题 I am looking for a way to add a custom strikethrough to a text widget like below I looked at the Text Style API, but couldn't find any option to customize the Strikethrough graphic. style: TextStyle(decoration: TextDecoration.lineThrough), 回答1: as an option import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Center( child: StrikeThroughWidget(

Flutter - How to make a custom TabBar

不打扰是莪最后的温柔 提交于 2021-01-21 10:10:39
问题 This is the output that I want. I am still new in flutter so can anyone let me know if there is already a widget for this kind of switch or how should I make one ?? Also, I want the data shown below this button to change if I choose the other button but I guess that's obvious. Thanks in advance. 回答1: You can use the TabBar widget to achieve this. I added a full example demonstrating how you can create this using the TabBar widget: CODE class StackOver extends StatefulWidget { @override

Flutter - How to make a custom TabBar

瘦欲@ 提交于 2021-01-21 10:07:12
问题 This is the output that I want. I am still new in flutter so can anyone let me know if there is already a widget for this kind of switch or how should I make one ?? Also, I want the data shown below this button to change if I choose the other button but I guess that's obvious. Thanks in advance. 回答1: You can use the TabBar widget to achieve this. I added a full example demonstrating how you can create this using the TabBar widget: CODE class StackOver extends StatefulWidget { @override

dart How to get an enum with index?

[亡魂溺海] 提交于 2021-01-21 07:28:44
问题 I defined an enum: enum TestEnum { test1, test2, } and I want make an enum with index: E buildEnum<E extends ?????????????????>(int index) { try { return E.values[index]; } catch(e) { return null; } } I don't know the type of enum. 回答1: enum A { a1, a2, a3} A.values[index] 回答2: You cannot make static accesses on a type parameter, so this cannot work. There is no way except reflection ( dart:mirrors ) to go from a value to a static member of its type. 回答3: I know what you mean, but it doesn't

How to BoxFit.cover a fullscreen VideoPlayer widget with specific aspect ratio

佐手、 提交于 2021-01-21 07:19:07
问题 I tried FittedBox , also wrapped all of them with ConstrainedBox , none of them worked. May be I missed some point. Issue is active in also: https://github.com/flutter/flutter/issues/31911 Here the code: @override Widget build(BuildContext context) { return Stack( children: <Widget>[ FittedBox( fit: BoxFit.cover, child: AspectRatio( aspectRatio: _aspectRatio, child: VideoPlayer(_playerController), ), ), _buildText(), ], ); } What I want is simple, I want to show video as fullscreen inside a

How to BoxFit.cover a fullscreen VideoPlayer widget with specific aspect ratio

混江龙づ霸主 提交于 2021-01-21 07:18:03
问题 I tried FittedBox , also wrapped all of them with ConstrainedBox , none of them worked. May be I missed some point. Issue is active in also: https://github.com/flutter/flutter/issues/31911 Here the code: @override Widget build(BuildContext context) { return Stack( children: <Widget>[ FittedBox( fit: BoxFit.cover, child: AspectRatio( aspectRatio: _aspectRatio, child: VideoPlayer(_playerController), ), ), _buildText(), ], ); } What I want is simple, I want to show video as fullscreen inside a

Recreate Flutter's ios and android folder with Swift and Kotlin

*爱你&永不变心* 提交于 2021-01-21 07:05:10
问题 Hi I just found out that it is possible to create Flutter project with Swift and Kotlin. However, I'm already invested in my current projects and want to recreate the ios and android as Swift and Kotlin (currently they are default to Java and ObjC). Thanks. 回答1: use -i and -a to create new project, like this: flutter create -i swift -a kotlin project_name see also:https://flutter.io/docs/development/platform-integration/platform-channels#step-1-create-a-new-app-project then replace with lib

Recreate Flutter's ios and android folder with Swift and Kotlin

Deadly 提交于 2021-01-21 07:05:00
问题 Hi I just found out that it is possible to create Flutter project with Swift and Kotlin. However, I'm already invested in my current projects and want to recreate the ios and android as Swift and Kotlin (currently they are default to Java and ObjC). Thanks. 回答1: use -i and -a to create new project, like this: flutter create -i swift -a kotlin project_name see also:https://flutter.io/docs/development/platform-integration/platform-channels#step-1-create-a-new-app-project then replace with lib

Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before _ScreenState.initState() completed

大憨熊 提交于 2021-01-21 06:20:25
问题 I am calling initial method to load data from API using initState. But it is resulting me an error. Here is error: Unhandled Exception: inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before _ScreenState.initState() completed. When an inherited widget changes, for example if the value of Theme.of() changes, its dependent widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor or an initState() method, then the

Build Flutter app in release mode for iOS

孤者浪人 提交于 2021-01-21 06:20:17
问题 I have Android Studio with Flutter plugin installed. Flutter SDK is also installed on my Mac through Android Studio and I know path to it. I want to run my app in release mode on real iOS device. Not only to hide "slow mode" banner that can be done using this code as I know new MaterialApp( debugShowCheckedModeBanner: false, ... but also to check how my app works. I found this instructions https://flutter.io/ios-release/ but still can't build app in release mode. Each time I try to run