WIP Themes: font size standartization
This commit is contained in:
parent
b8ba3c59e9
commit
4432124e8c
@ -108,10 +108,8 @@ class _GaugeCardBodyState extends State<GaugeCardBody> {
|
||||
//textAlign: TextAlign.center,
|
||||
expanded: false,
|
||||
maxLines: 1,
|
||||
bold: true,
|
||||
textAlign: TextAlign.center,
|
||||
padding: EdgeInsets.all(0.0),
|
||||
fontSize: fontSize,
|
||||
padding: EdgeInsets.all(0.0)
|
||||
//padding: EdgeInsets.only(top: Sizes.rowPadding),
|
||||
),
|
||||
);
|
||||
|
@ -69,7 +69,7 @@ class GlanceCardEntityContainer extends StatelessWidget {
|
||||
textOverflow: TextOverflow.ellipsis,
|
||||
wordsWrap: wordsWrapInName,
|
||||
textAlign: TextAlign.center,
|
||||
textStyle: Theme.of(context).textTheme.caption,
|
||||
textStyle: Theme.of(context).textTheme.body1,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -34,60 +34,5 @@ class _LightCardBodyState extends State<LightCardBody> {
|
||||
),
|
||||
);
|
||||
|
||||
return InkWell(
|
||||
onTap: () => entityWrapper.handleTap(),
|
||||
onLongPress: () => entityWrapper.handleHold(),
|
||||
onDoubleTap: () => entityWrapper.handleDoubleTap(),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.5,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
overflow: Overflow.clip,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
double fontSize = constraints.maxHeight / 7;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 2*fontSize),
|
||||
child: SimpleEntityState(
|
||||
//textAlign: TextAlign.center,
|
||||
expanded: false,
|
||||
maxLines: 1,
|
||||
bold: true,
|
||||
textAlign: TextAlign.center,
|
||||
padding: EdgeInsets.all(0.0),
|
||||
fontSize: fontSize,
|
||||
//padding: EdgeInsets.only(top: Sizes.rowPadding),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
double fontSize = constraints.maxHeight / 7;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: fontSize),
|
||||
child: EntityName(
|
||||
textStyle: Theme.of(context).textTheme.body1.copyWith(
|
||||
fontSize: fontSize
|
||||
),
|
||||
maxLines: 1,
|
||||
padding: EdgeInsets.all(0.0),
|
||||
textAlign: TextAlign.center,
|
||||
textOverflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -126,10 +126,10 @@ class Sizes {
|
||||
static const extendedWidgetHeight = 50.0;
|
||||
static const iconSize = 28.0;
|
||||
static const largeIconSize = 46.0;
|
||||
static const stateFontSize = 15.0;
|
||||
static const nameFontSize = 15.0;
|
||||
static const smallFontSize = 14.0;
|
||||
static const largeFontSize = 24.0;
|
||||
//static const stateFontSize = 15.0;
|
||||
//static const nameFontSize = 15.0;
|
||||
//static const smallFontSize = 14.0;
|
||||
//static const largeFontSize = 24.0;
|
||||
static const inputWidth = 160.0;
|
||||
static const rowPadding = 10.0;
|
||||
static const doubleRowPadding = rowPadding*2;
|
||||
|
@ -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,
|
||||
|
@ -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),
|
||||
));
|
||||
}
|
||||
|
@ -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,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
@ -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
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
@ -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(" ", " ");
|
||||
}
|
||||
|
@ -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
|
||||
),
|
||||
),
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -14,17 +14,18 @@ class HAClientTheme {
|
||||
HAClientTheme._internal();
|
||||
|
||||
final ThemeData lightTheme = ThemeData.light().copyWith(
|
||||
primaryColor: Colors.lightBlue,
|
||||
textTheme: ThemeData.light().textTheme.copyWith(
|
||||
display1: TextStyle(fontSize: 34, fontWeight: FontWeight.normal, color: Colors.black54),
|
||||
display2: TextStyle(fontSize: 34, fontWeight: FontWeight.normal, color: Colors.redAccent),
|
||||
headline: TextStyle(fontSize: 24, fontWeight: FontWeight.normal, color: defaultFontColor),
|
||||
title: TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: defaultFontColor),
|
||||
subhead: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: defaultFontColor),
|
||||
subhead: TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black54),
|
||||
body1: TextStyle(fontSize: 15, fontWeight: FontWeight.normal, color: defaultFontColor),
|
||||
body2: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: defaultFontColor),
|
||||
subtitle: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.black45),
|
||||
caption: TextStyle(fontSize: 13, fontWeight: FontWeight.normal, color: defaultFontColor),
|
||||
overline: TextStyle(fontSize: 10, fontWeight: FontWeight.normal, color: Colors.black54),
|
||||
caption: TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: Colors.black26),
|
||||
overline: TextStyle(fontSize: 10, fontWeight: FontWeight.normal, color: Colors.black26),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -539,9 +539,8 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
}
|
||||
|
||||
void _showErrorBottomBar(HAError error) {
|
||||
TextStyle textStyle = TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: Sizes.nameFontSize
|
||||
TextStyle textStyle = Theme.of(context).textTheme.subhead.copyWith(
|
||||
color: Colors.blue
|
||||
);
|
||||
_bottomBarColor = Colors.red.shade100;
|
||||
List<Widget> actions = [];
|
||||
|
@ -10,8 +10,7 @@ class LastUpdatedWidget extends StatelessWidget {
|
||||
child: Text(
|
||||
'${entityModel.entityWrapper.entity.lastUpdated}',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: Sizes.smallFontSize, color: Colors.black26),
|
||||
style: Theme.of(context).textTheme.caption
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ class LinkToWebConfig extends StatelessWidget {
|
||||
title: Text("${this.name}",
|
||||
textAlign: TextAlign.left,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: new TextStyle(fontWeight: FontWeight.bold, fontSize: Sizes.largeFontSize)),
|
||||
style: Theme.of(context).textTheme.headline),
|
||||
subtitle: Text("Tap to open web version"),
|
||||
onTap: () {
|
||||
Launcher.launchAuthenticatedWebView(context: context, url: this.url, title: this.name);
|
||||
|
Reference in New Issue
Block a user