小编Nik*_*war的帖子

使用integration_test包进行Flutter集成测试调试

我正在使用 Integration_test 包编写集成测试。它运作良好。

我在 CLI 中运行以下命令来开始测试。

flutter drive --driver=test_driver/integration_test_driver.dart --target=test/integration_tests/app_test.dart
Run Code Online (Sandbox Code Playgroud)

但每次重新运行测试时都需要重建应用程序。我们可以避免App的重建吗?

还可以将调试器附加到测试用例,例如调试单元或小部件测试。

debugging flutter flutter-test

5
推荐指数
1
解决办法
1849
查看次数

在应用程序中将颜色设置为文本小部件在颤动中普遍适用,而无需每次都提及小部件内部的主题

我是新来的颤振和尝试的东西。

我用一个中心小部件替换了脚手架小部件(只是乱搞)。所有文本都有一个黄色下划线,为了克服这个我用TextDecoration

Text(
    friend.name,
    style: TextStyle(
        decoration: TextDecoration.none
    ),
));
Run Code Online (Sandbox Code Playgroud)

但这对于所有 Text 小部件都是必需的,因此我尝试通过在根 MaterialApp 中设置 Theme 数据来为所有 Text 小部件通用设置它。

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp( 
      title: 'Friends List',
      theme: ThemeData(
        primaryColor: Colors.black,
        primarySwatch: Colors.teal,
        primaryTextTheme: TextTheme(
          headline1: TextStyle(color: Colors.green, decoration: TextDecoration.none),
         headline2: TextStyle(color: Colors.green, decoration: TextDecoration.none),
         headline3: TextStyle(color: Colors.green, decoration: TextDecoration.none),
         headline4: TextStyle(color: Colors.green, decoration: TextDecoration.none),
         headline5: TextStyle(color: Colors.green, decoration: TextDecoration.none),
         headline6: TextStyle(color: Colors.green, …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-theme flutter-widget

2
推荐指数
1
解决办法
1661
查看次数