简体   繁体   English

什么是 flutter 中 textTheme 的替代品。 我收到以下错误

[英]what is replacement for textTheme in flutter. I'm getting following error

I'm new to flutter getting this error.我是 flutter 的新手,收到此错误。 can anyone please help with this?有人可以帮忙吗? trying to and text styles.尝试发短信给 styles。

在此处输入图像描述

import 'package:flutter/material.dart';
import 'screens/location_detail/location_detail.dart';
import 'style.dart';


class App extends StatelessWidget{

  @override
  Widget build(BuildContext context) {
   return MaterialApp(
     home:LocationDetail(),
     theme:ThemeData(
       appBarTheme: AppBarTheme(
         textTheme: TextTheme(title: AppBarTextStyle)
       )
     )
   );
  }
}

You can use toolBarTextStyle and titleTextStyle instead of textTheme .您可以使用toolBarTextStyletitleTextStyle代替textTheme For more details please refer below link textTheme有关更多详细信息,请参阅下面的链接textTheme

You can use titleTextStyle like this:您可以像这样使用titleTextStyle

appBarTheme: AppBarTheme(
     titleTextStyle: TextStyle(color: Colors.blue)
)

appBar: AppBar(
    title: Text(
      ' ',
      style: Theme.of(context).appBarTheme.titleTextStyle,
    ),

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 替换 flutter 中已弃用的 textTheme - Replacement of deprecated textTheme in flutter 我正在尝试将 Json 数据转换为 model class 在 ZC047B10EEE71CC268 但我收到“Flutter FormatException:意外字符”错误 - I'm trying to prase the Json data to model class in Flutter. but i'm getting "Flutter FormatException: Unexpected character" Error 在 Flutter 中使用翻译器 API 时收到太多请求(错误:429)。 我该如何解决这个问题 - I'm getting too many requests (error: 429) when using the translator API in Flutter. How do i solve this 我正在尝试使用 Intl package 来格式化 Flutter 中的日期。 但是,它给我一个错误 - I'm trying to use the Intl package to format a date in Flutter. However, it's throwing me an error 我在运行 flutter 默认的初始计数器应用程序时在控制台上得到了这个。我该如何解决这个问题? - I"m getting this on the console while running the initial counter app that comes default with flutter. How do i fix this? 我在颤振中收到一个调用空错误的吸气剂。 在尝试访问列表的长度时 - I am getting a getter called on null error in flutter. while trying to access the length of a list flutter 中的“类型 'double' 不是类型转换中类型 'int' 的子类型”错误。 我应该怎么办? - “type 'double' is not a subtype of type 'int' in type cast” error in flutter. What should i do? 在遵循 Flutter Firebase 教程时,我在 dart 中收到未为对象错误定义的 [] 错误? - I'm getting an [] isn't defined for Object error in dart when following a Flutter Firebase tutorial? 我正在关注 Flutter 入门教程,但是在运行 get package 时出现错误 - I'm following getting started with Flutter tutorials,but while running get package it gets me error flutter 中的位置 package 出现错误。 怎么修? - Getting an error with the Location package in flutter. how to fix?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM