我是Flutter的新手,并且正在尝试为我的App制作一个独特的主题。这就是我所做的。
import 'package:flutter/material.dart';
import 'login.dart';
class ElBorsaApp extends StatelessWidget {
static const kPrimaryColor = const Color(0xFF4db6ac);
static const kPrimaryDarkColor = const Color(0xFF00867d);
static const kSecondaryColor = const Color(0xFFff9800);
static const kSecondaryDarkColor = const Color(0xFFc66900);
static const kBrown900 = const Color(0xFF442B2D);
static const kOrange900 = const Color(0xFFdd2c00);
static const kErrorRed = const Color(0xFFC5032B);
static const kSurfaceWhite = const Color(0xFFFFFBFA);
static const kBackgroundWhite = Colors.white;
static const TextStyle s = TextStyle(
color: Colors.white,
);
@override
Widget build(BuildContext context) {
ThemeData baseTheme = ThemeData.light();
return MaterialApp(
home: Builder(builder: (context) => Login()),
theme: baseTheme.copyWith(
primaryColor: kPrimaryColor,
primaryColorDark: kPrimaryDarkColor,
accentColor: kBrown900,
cursorColor: kPrimaryDarkColor,
textSelectionHandleColor: kPrimaryDarkColor,
buttonTheme: baseTheme.buttonTheme.copyWith(
buttonColor: kSecondaryColor,
textTheme: ButtonTextTheme.accent,
),
),
);
}
}
我试图将任何按钮的textTheme主题设置为强调色。
但是,颜色始终为蓝色(默认颜色)