Я пытаюсь создать данные настраиваемой темы примерно так.
class CustomTheme {
static ThemeData get lightTheme {
return ThemeData(
textTheme: TextTheme(
headline1: h1.copyWith(color: Color(0xff444444)),
headline2: h2.copyWith(color: Color(0xff444444)),
headline3: h3.copyWith(color: Color(0xff444444)),
headline4: h4.copyWith(color: Color(0xff444444)),
headline5: h5.copyWith(color: Color(0xff444444)),
headline6: h6.copyWith(color: Color(0xff444444)),
subtitle1: TextStyle(color: Color(0xff444444)),
subtitle2: TextStyle(color: Color(0xff444444)),
bodyText1: TextStyle(color: Color(0xff444444)),
bodyText2: TextStyle(color: Color(0xff444444)),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0),
side: BorderSide(color: kButtonBorderColor)),
backgroundColor: kButtonBackgroundColor,
),
),
);
}
static ThemeData get darkTheme {
return ThemeData(
textTheme: TextTheme(
headline1: h1.copyWith(color: Color(0xffebebeb)),
headline2: h2.copyWith(color: Color(0xffebebeb)),
headline3: h3.copyWith(color: Color(0xffebebeb)),
headline4: h4.copyWith(color: Color(0xffebebeb)),
headline5: h5.copyWith(color: Color(0xffebebeb)),
headline6: h6.copyWith(color: Color(0xffebebeb)),
subtitle1: TextStyle(color: Color(0xffebebeb)),
subtitle2: TextStyle(color: Color(0xffebebeb)),
bodyText1: TextStyle(color: Color(0xffebebeb)),
bodyText2: TextStyle(color: Color(0xffebebeb)),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0),
side: BorderSide(color: kButtonBorderColor)),
backgroundColor: kButtonBackgroundColorDark,
),
),
);
}
}
Мое требование: у меня есть два разных стиля кнопок (по 2 для каждого светлого и темного режима), как показано ниже.
Как вы можете видеть из моего кода, я могу указать только один цвет фона для своего стиля кнопки для светлой и темной темы. Я не могу установить дополнительную текстовую кнопку в теме данных. Как я могу установить эти 2 стиля кнопок в данных моей темы? или есть ли какой-либо другой способ обработки двух разных стилей как для светлой, так и для темной темы?