WIP Themes: Make all fonts depend on theme

This commit is contained in:
Yegor Vialov
2020-04-04 15:13:55 +00:00
parent f448a20784
commit a0a0cb4612
20 changed files with 88 additions and 105 deletions

View File

@ -121,9 +121,8 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
onTap: () => Launcher.launchURLInCustomTab(context: context, url: "http://ha-client.app/docs#location-tracking"),
child: Text(
"Please read documentation!",
style: TextStyle(
style: Theme.of(context).textTheme.subhead.copyWith(
color: Colors.blue,
fontSize: 16,
decoration: TextDecoration.underline
)
),
@ -180,13 +179,13 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
RaisedButton(
color: Colors.blue,
onPressed: () => updateRegistration(),
child: Text("Check integration", style: TextStyle(color: Colors.white))
child: Text("Check integration", style: Theme.of(context).textTheme.button)
),
Container(width: 10.0,),
RaisedButton(
color: Colors.redAccent,
onPressed: () => resetRegistration(),
child: Text("Reset integration", style: TextStyle(color: Colors.white))
child: Text("Reset integration", style: Theme.of(context).textTheme.button)
)
],
),

View File

@ -347,11 +347,10 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
accountName: Text(HomeAssistant().userName),
accountEmail: Text(HomeAssistant().locationName ?? ""),
currentAccountPicture: CircleAvatar(
backgroundColor: Theme.of(context).backgroundColor,
child: Text(
HomeAssistant().userAvatarText,
style: TextStyle(
fontSize: 32.0
),
style: Theme.of(context).textTheme.display1
),
),
)
@ -360,21 +359,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
HomeAssistant().panels.forEach((Panel panel) {
if (!panel.isHidden) {
menuItems.add(
new ListTile(
leading: Icon(MaterialDesignIcons.getIconDataFromIconName(panel.icon)),
title: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("${panel.title}"),
Container(width: 4.0,),
panel.isWebView ? Text("webview", style: TextStyle(fontSize: 8.0, color: Colors.black45),) : Container(width: 1.0,)
],
),
onTap: () {
Navigator.of(context).pop();
panel.handleOpen(context);
}
)
panel.getMenuItemWidget(context)
);
}
});
@ -458,9 +443,9 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
},
child: Text(
"ha-client.app",
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
),
@ -474,9 +459,9 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
},
child: Text(
"Terms and Conditions",
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
),
@ -490,9 +475,9 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
},
child: Text(
"Privacy Policy",
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
)
@ -648,9 +633,9 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
activePlayers.map((entity) => PopupMenuItem<String>(
child: Text(
"${entity.displayName}",
style: TextStyle(
style: Theme.of(context).textTheme.body1.copyWith(
color: EntityColor.stateColor(entity.state)
),
)
),
value: "${entity.entityId}",
)).toList()
@ -679,7 +664,12 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
shape: BoxShape.circle,
),
child: Center(
child: Text("$playersCount", style: TextStyle(fontSize: 12)),
child: Text(
"$playersCount",
style: Theme.of(context).textTheme.caption.copyWith(
color: Colors.white
)
),
),
),
)
@ -697,7 +687,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Text("Login with Home Assistant", style: TextStyle(fontSize: 16.0, color: Colors.white)),
child: Text("Login with Home Assistant", style: Theme.of(context).textTheme.button),
color: Colors.blue,
onPressed: () => _fullLoad(),
)

View File

@ -135,7 +135,9 @@ class _PlayMediaPageState extends State<PlayMediaPage> {
if (_validationMessage.isNotEmpty) {
children.add(Text(
"$_validationMessage",
style: TextStyle(color: Colors.red)
style: Theme.of(context).textTheme.body1.copyWith(
color: Theme.of(context).errorColor
)
));
}
children.addAll(<Widget>[
@ -193,9 +195,9 @@ class _PlayMediaPageState extends State<PlayMediaPage> {
},
child: Text(
"How?",
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline
),
),
),

View File

@ -138,10 +138,7 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
children: <Widget>[
Text(
"Connection settings",
style: TextStyle(
color: Colors.black45,
fontSize: 20.0
),
style: Theme.of(context).textTheme.headline,
),
new Row(
children: [
@ -176,16 +173,13 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
),
new Text(
"Try ports 80 and 443 if default is not working and you don't know why.",
style: TextStyle(color: Colors.grey),
style: Theme.of(context).textTheme.caption,
),
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Text(
"UI",
style: TextStyle(
color: Colors.black45,
fontSize: 20.0
),
style: Theme.of(context).textTheme.headline,
),
),
new Row(
@ -203,15 +197,14 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
),
Text(
"Authentication settings",
style: TextStyle(
color: Colors.black45,
fontSize: 20.0
),
style: Theme.of(context).textTheme.headline,
),
Container(height: 10.0,),
Text(
"You can leave this field blank to make app generate new long-lived token automatically by asking you to login to your Home Assistant. Use this field only if you still want to use manually generated long-lived token. Leave it blank if you don't understand what we are talking about.",
style: TextStyle(color: Colors.redAccent),
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.redAccent
),
),
new TextField(
decoration: InputDecoration(

View File

@ -23,7 +23,7 @@ class PageLoadingError extends StatelessWidget {
size: 48.0
)
),
Text(this.errorText, style: TextStyle(color: Colors.black45))
Text(this.errorText, style: Theme.of(context).textTheme.subtitle)
],
)
],

View File

@ -14,7 +14,7 @@ class PageLoadingIndicator extends StatelessWidget {
padding: EdgeInsets.only(top: 40.0, bottom: 20.0),
child: CircularProgressIndicator()
),
Text("Loading...", style: TextStyle(color: Colors.black45))
Text("Loading...", style: Theme.of(context).textTheme.subtitle)
],
)
],

View File

@ -40,10 +40,7 @@ class ProductPurchase extends StatelessWidget {
children: <Widget>[
Text(
"${product.title}",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.0
),
style: Theme.of(context).textTheme.body2,
),
Container(height: Sizes.rowPadding,),
Text(
@ -53,7 +50,9 @@ class ProductPurchase extends StatelessWidget {
softWrap: true,
),
Container(height: Sizes.rowPadding,),
Text("${product.price} $period", style: TextStyle(color: priceColor)),
Text("${product.price} $period", style: Theme.of(context).textTheme.body1.copyWith(
color: priceColor
)),
],
)
),
@ -61,7 +60,7 @@ class ProductPurchase extends StatelessWidget {
Expanded(
flex: 2,
child: RaisedButton(
child: Text(this.purchased ? buttonTextInactive : buttonText, style: TextStyle(color: Colors.white)),
child: Text(this.purchased ? buttonTextInactive : buttonText, style: Theme.of(context).textTheme.button),
color: Colors.blue,
onPressed: this.purchased ? null : () => this.onBuy(this.product),
),