WIP Themes: font size standartization

This commit is contained in:
Yegor Vialov
2020-04-04 12:47:40 +00:00
parent b8ba3c59e9
commit 4432124e8c
16 changed files with 47 additions and 118 deletions

View File

@ -64,9 +64,7 @@ class _CoverControlWidgetState extends State<CoverControlWidget> {
Padding(
padding: EdgeInsets.fromLTRB(
0.0, Sizes.rowPadding, 0.0, Sizes.rowPadding),
child: Text("Position", style: TextStyle(
fontSize: Sizes.stateFontSize
)),
child: Text("Position"),
),
Slider(
value: _tmpPosition,
@ -118,9 +116,7 @@ class _CoverControlWidgetState extends State<CoverControlWidget> {
controls.insert(0, Padding(
padding: EdgeInsets.fromLTRB(
0.0, Sizes.rowPadding, 0.0, Sizes.rowPadding),
child: Text("Tilt position", style: TextStyle(
fontSize: Sizes.stateFontSize
)),
child: Text("Tilt position"),
));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -9,10 +9,8 @@ class DateTimeStateWidget extends StatelessWidget {
padding: EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0),
child: GestureDetector(
child: Text("${entity.formattedState}",
textAlign: TextAlign.right,
style: new TextStyle(
fontSize: Sizes.stateFontSize,
)),
textAlign: TextAlign.right
),
onTap: () => _handleStateTap(context, entity),
));
}

View File

@ -6,7 +6,6 @@ class FlatServiceButton extends StatelessWidget {
final String serviceName;
final String entityId;
final String text;
final double fontSize;
FlatServiceButton({
Key key,
@ -14,7 +13,6 @@ class FlatServiceButton extends StatelessWidget {
@required this.serviceName,
@required this.entityId,
@required this.text,
this.fontSize: Sizes.stateFontSize
}) : super(key: key);
void _setNewState() {
@ -24,7 +22,7 @@ class FlatServiceButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: fontSize*2.5,
height: Theme.of(context).textTheme.subhead.fontSize*2.5,
child: FlatButton(
onPressed: (() {
_setNewState();
@ -32,8 +30,7 @@ class FlatServiceButton extends StatelessWidget {
child: Text(
text,
textAlign: TextAlign.right,
style:
new TextStyle(fontSize: fontSize, color: Colors.blue),
style: Theme.of(context).textTheme.subhead,
),
)
);

View File

@ -28,8 +28,9 @@ class LockStateWidget extends StatelessWidget {
onPressed: () => _unlock(entity),
child: Text("UNLOCK",
textAlign: TextAlign.right,
style:
new TextStyle(fontSize: Sizes.stateFontSize, color: Colors.blue),
style: Theme.of(context).textTheme.subhead.copyWith(
color: Colors.blue
)
),
)
),
@ -39,8 +40,9 @@ class LockStateWidget extends StatelessWidget {
onPressed: () => _lock(entity),
child: Text("LOCK",
textAlign: TextAlign.right,
style:
new TextStyle(fontSize: Sizes.stateFontSize, color: Colors.blue),
style: Theme.of(context).textTheme.subhead.copyWith(
color: Colors.blue
),
),
)
)
@ -56,8 +58,9 @@ class LockStateWidget extends StatelessWidget {
child: Text(
entity.isLocked ? "UNLOCK" : "LOCK",
textAlign: TextAlign.right,
style:
new TextStyle(fontSize: Sizes.stateFontSize, color: Colors.blue),
style: Theme.of(context).textTheme.subhead.copyWith(
color: Colors.blue
),
),
)
);

View File

@ -7,10 +7,9 @@ class SimpleEntityState extends StatelessWidget {
final EdgeInsetsGeometry padding;
final int maxLines;
final String customValue;
final double fontSize;
final bool bold;
//final bool bold;
const SimpleEntityState({Key key,this.bold: false, this.maxLines: 10, this.fontSize: Sizes.stateFontSize, this.expanded: true, this.textAlign: TextAlign.right, this.padding: const EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0), this.customValue}) : super(key: key);
const SimpleEntityState({Key key,/*this.bold: false,*/ this.maxLines: 10, this.expanded: true, this.textAlign: TextAlign.right, this.padding: const EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0), this.customValue}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -22,16 +21,17 @@ class SimpleEntityState extends StatelessWidget {
} else {
state = customValue;
}
TextStyle textStyle = TextStyle(
fontSize: this.fontSize,
fontWeight: FontWeight.normal
);
TextStyle textStyle;
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.CALL_SERVICE) {
textStyle = textStyle.apply(color: Colors.blue);
textStyle = Theme.of(context).textTheme.subhead.copyWith(
color: Colors.blue
);
} else {
textStyle = Theme.of(context).textTheme.body1;
}
if (this.bold) {
/*if (this.bold) {
textStyle = textStyle.apply(fontWeightDelta: 100);
}
}*/
while (state.contains(" ")){
state = state.replaceAll(" ", " ");
}

View File

@ -62,8 +62,7 @@ class _SliderControlsWidgetState extends State<SliderControlsWidget> {
children: <Widget>[
Text(
"$_newValue",
style: TextStyle(
fontSize: Sizes.largeFontSize,
style: Theme.of(context).textTheme.display1.copyWith(
color: Colors.blue
),
),

View File

@ -40,10 +40,7 @@ class UniversalSlider extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(height: Sizes.rowPadding,),
Text(
"$title",
style: TextStyle(fontSize: Sizes.stateFontSize),
),
Text("$title"),
Container(height: Sizes.rowPadding,),
Row(
mainAxisSize: MainAxisSize.min,

View File

@ -10,7 +10,7 @@ class VacuumControls extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_buildStatusAndBattery(entity),
_buildStatusAndBattery(entity, context),
_buildCommands(entity),
_buildFanSpeed(entity),
_buildAdditionalInfo(entity)
@ -19,12 +19,12 @@ class VacuumControls extends StatelessWidget {
);
}
Widget _buildStatusAndBattery(VacuumEntity entity) {
Widget _buildStatusAndBattery(VacuumEntity entity, BuildContext context) {
List<Widget> result = [];
if (entity.supportStatus) {
result.addAll(
<Widget>[
Text("Status:", style: TextStyle(fontSize: Sizes.stateFontSize),),
Text("Status:"),
Container(width: 6,),
Expanded(
//flex: 1,
@ -33,10 +33,7 @@ class VacuumControls extends StatelessWidget {
maxLines: 1,
softWrap: true,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: Sizes.stateFontSize,
fontWeight: FontWeight.bold
),
style: Theme.of(context).textTheme.body2,
),
),
]
@ -48,7 +45,7 @@ class VacuumControls extends StatelessWidget {
result.addAll(<Widget>[
Icon(MaterialDesignIcons.getIconDataFromIconName(iconName)),
Container(width: 6,),
Text("$batteryLevel %", style: TextStyle(fontSize: Sizes.stateFontSize))
Text("$batteryLevel %")
]
);
}
@ -172,7 +169,7 @@ class VacuumControls extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Vacuum cleaner commands:", style: TextStyle(fontSize: Sizes.stateFontSize)),
Text("Vacuum cleaner commands:"),
Container(height: Sizes.rowPadding,),
Row(
mainAxisSize: MainAxisSize.max,