flutter-test


Images are not visible during flutter_driver tests

自作多情 提交于 2020-01-24 10:23:15
问题 When running UI tests with flutter driver the assets are not displayed on iPhone simulator. They are displayed when app is run in debug mode from VS Code. I tried to reproduce it on the example project generated by flutter create -i swift -a kotlin --androidx --org com.example example but without success. I followed exactly the same process of introducing flutter_driver tests in both apps according to this article. Unfortunately, in my app the images are not shown, and in example app they

How to make a task run in the background in Flutter

可紊 提交于 2020-01-24 05:49:04
问题 I have a music app that streams audio online. The only problem is it gets killed every time I exit the app which is not good for the user. They need it to keep running in the background even after exiting. How can I achieve this? 回答1: Can I run Dart code in the background of an Flutter app? Yes, you can run Dart code in a background process on both iOS and Android. For more information, see the Medium article Executing Dart in the Background with Flutter Plugins and Geofencing. 来源: https:/

how to refresh state on Navigator.Pop or Push in flutter

雨燕双飞 提交于 2020-01-16 05:24:05
问题 Here I have two pages first is called BSP_signup_terms page and the second is Bsp_Service_page . when I am on BSP_signup_terms on that page I have to select some checkbox based on the selected checkbox it will show me some data. but problem is that it will show me the complete data but when I get back to the BSP_signup_terms from Bsp_signup_page and I am changing the checkbox and then again when I am pressing next button it will not change the result it same as the previous result. Here is

Is it possible to access children/parent widgets from a given widget, in a Flutter test?

[亡魂溺海] 提交于 2020-01-14 07:03:37
问题 I'm writing unit and integration tests for Flutter. Is it possible to access children/parent widgets from a given widget? 回答1: Yes, you can use find.descendant and Element.ancestorWidgetOfExactType. Examples: // Finds a RichText widget that a descendant (child/grand-child/etc) of a // tab widget with text "Tab 1" find.descendant(of: find.text('Tab 1'), matching: find.byType(RichText)); // Finds a parent widget of type MyParentWidget. tester.element(find.byType(MyChildWidget))

Is it possible to access children/parent widgets from a given widget, in a Flutter test?

核能气质少年 提交于 2020-01-14 07:03:26
问题 I'm writing unit and integration tests for Flutter. Is it possible to access children/parent widgets from a given widget? 回答1: Yes, you can use find.descendant and Element.ancestorWidgetOfExactType. Examples: // Finds a RichText widget that a descendant (child/grand-child/etc) of a // tab widget with text "Tab 1" find.descendant(of: find.text('Tab 1'), matching: find.byType(RichText)); // Finds a parent widget of type MyParentWidget. tester.element(find.byType(MyChildWidget))

How to crop circular(or Square or Hexagon ) area from canvas in Flutter

痞子三分冷 提交于 2020-01-06 04:49:08
问题 I want to crop a rectangular image-file and make it circular or square or hexagon shape and save it as image-file locally . I have a bitmap and I want to crop a circular or hexagon region from this bitmap. All pixels outside the circle should be transparent. How can I do this? I found the similar question in android platform. But unable to find a good resource that really help or direct me to achieve this in flutter. Please share me the idea to achieve this result. 回答1: Use Clipper to crop

Flutter error: Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)

最后都变了- 提交于 2020-01-03 16:51:17
问题 I'm failing to run my first ever Flutter App. Getting the below error. Launching lib\main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Resolving dependencies... * Error running Gradle: Exit code 1 from: D:\PROJECTS\softwareProjects\AndroidProjects\flutter_app_2\android\gradlew.bat app:properties: Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar FAILURE: Build failed with an exception. * What went wrong: A problem

Flutter: Testing for exceptions in widget tests

前提是你 提交于 2020-01-02 04:47:11
问题 How do I go about making sure the ui (widget) throws an exception during widget testing in Flutter. Here is my code that does not work: expect( () => tester.tap(find.byIcon(Icons.send)), throwsA(const TypeMatcher<UnrecognizedTermException>()), ); It fails with the following error ... Expected: throws <Instance of 'TypeMatcher<UnrecognizedTermException>'> Actual: <Closure: () => Future<void>> Which: returned a Future that emitted <null> OR......should I be testing how the UI handles an

Flutter: Timer Issue During Testing

痞子三分冷 提交于 2020-01-01 16:02:10
问题 I have a periodic timer in one of my StatelessWidget 's. Without going too much into detail, here is a snippet of code producing a timer: class AnniversaryHomePage extends StatelessWidget { . . . void _updateDisplayTime(StoreInheritedWidget inheritedWidget) { String anniversaryString = inheritedWidget.prefs.getString('anniversaryDate'); inheritedWidget.store.dispatch(DateTime.parse(anniversaryString)); } /// Widget Methods @override Widget build(BuildContext context) { final inheritedWidget =

How to find off-screen ListView child in widget tests?

痴心易碎 提交于 2019-12-24 14:16:26
问题 When displaying multiple children in a ListView, if a child is off-screen it can't be found by a widget test. Here's a full example: main.dart import 'package:flutter/material.dart'; void main() => runApp(App()); class App extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp(home: Scaffold(body: Test())); } } class Test extends StatelessWidget { @override Widget build(BuildContext context) { return ListView( children: <Widget>[ Container( height: 600,

工具导航Map