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

@ -248,7 +248,9 @@ class _AlarmControlPanelControlsWidgetWidgetState extends State<AlarmControlPane
FlatButton(
child: Text(
"TRIGGER",
style: TextStyle(color: Colors.redAccent)
style: Theme.of(context).textTheme.subhead.copyWith(
color: Colors.redAccent
)
),
onPressed: () => _askToTrigger(entity),
)

View File

@ -64,7 +64,6 @@ class BadgeWidget extends StatelessWidget {
overflow: TextOverflow.fade,
softWrap: false,
textAlign: TextAlign.center,
style: TextStyle(fontSize: stateFontSize),
),
);
break;
@ -77,7 +76,9 @@ class BadgeWidget extends StatelessWidget {
onBadgeText = Container(
padding: EdgeInsets.fromLTRB(6.0, 2.0, 6.0, 2.0),
child: Text("$onBadgeTextValue",
style: TextStyle(fontSize: 12.0, color: Colors.white),
style: Theme.of(context).textTheme.overline.copyWith(
color: Colors.white
),
textAlign: TextAlign.center,
softWrap: false,
overflow: TextOverflow.fade),
@ -131,7 +132,7 @@ class BadgeWidget extends StatelessWidget {
child: Text(
"${entityModel.entityWrapper.displayName}",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12.0),
style: Theme.of(context).textTheme.caption,
softWrap: true,
maxLines: 3,
overflow: TextOverflow.ellipsis,

View File

@ -29,7 +29,9 @@ class DefaultEntityContainer extends StatelessWidget {
),
Text(
"${entityModel.entityWrapper.entity.displayName}",
style: TextStyle(color: Colors.blue),
style: Theme.of(context).textTheme.body1.copyWith(
color: Colors.blue
),
)
],
);

View File

@ -25,10 +25,8 @@ class EntityPageLayout extends StatelessWidget {
padding: EdgeInsets.only(left: 8),
child: Text(
entity.displayName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 22
style: Theme.of(context).textTheme.headline.copyWith(
color: Colors.white
),
),
),

View File

@ -183,7 +183,7 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
}
return UniversalSlider(
title: "Color temperature",
leading: Text("Cold", style: TextStyle(color: Colors.lightBlue),),
leading: Text("Cold", style: Theme.of(context).textTheme.body1.copyWith(color: Colors.lightBlue)),
value: val,
onChangeEnd: (value) => _setColorTemp(entity, value),
max: entity.maxMireds,
@ -194,7 +194,7 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
_tmpColorTemp = value.round();
});
},
closing: Text("Warm", style: TextStyle(color: Colors.amberAccent),),
closing: Text("Warm", style: Theme.of(context).textTheme.body1.copyWith(color: Colors.amberAccent),),
);
} else {
return Container(width: 0.0, height: 0.0);

View File

@ -13,12 +13,6 @@ class _MediaPlayerSeekBarState extends State<MediaPlayerSeekBar> {
double _currentPosition = 0;
int _savedPosition = 0;
final TextStyle _seekTextStyle = TextStyle(
fontSize: 20,
color: Colors.blue,
fontWeight: FontWeight.bold
);
@override
initState() {
super.initState();
@ -79,7 +73,13 @@ class _MediaPlayerSeekBarState extends State<MediaPlayerSeekBar> {
children: <Widget>[
Text("00:00"),
Expanded(
child: Text("${Duration(seconds: _currentPosition.toInt()).toString().split(".")[0]}",textAlign: TextAlign.center, style: _seekTextStyle),
child: Text(
"${Duration(seconds: _currentPosition.toInt()).toString().split(".")[0]}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.title.copyWith(
color: Colors.blue
)
),
),
Text("${Duration(seconds: entity.durationSeconds).toString().split(".")[0]}")
],

View File

@ -19,7 +19,7 @@ class MediaPlayerWidget extends StatelessWidget {
right: 0.0,
child: Container(
color: Colors.black45,
child: _buildState(entity),
child: _buildState(entity, context),
),
),
Positioned(
@ -35,12 +35,9 @@ class MediaPlayerWidget extends StatelessWidget {
);
}
Widget _buildState(MediaPlayerEntity entity) {
TextStyle style = TextStyle(
fontSize: 14.0,
color: Colors.white,
fontWeight: FontWeight.normal,
height: 1.2
Widget _buildState(MediaPlayerEntity entity, BuildContext context) {
TextStyle style = Theme.of(context).textTheme.body1.copyWith(
color: Colors.white
);
List<Widget> states = [];
states.add(Text("${entity.displayName}", style: style));

View File

@ -27,10 +27,7 @@ class VacuumStateButton extends StatelessWidget {
text: "RETURN TO DOCK"
);
} else {
result = Text(entity.state.toUpperCase(), style: TextStyle(
fontSize: 16,
color: Colors.grey
));
result = Text(entity.state.toUpperCase(), style: Theme.of(context).textTheme.subhead);
}
return Padding(
padding: EdgeInsets.only(right: 15),