I have a application which has a couple buttons which contain an icon, a title, and some text. I and viewing the application on 3 android emulators. xxhdpi, hdpi, and mdpi created from Android Studio. However they all have different designs. How do I set it so that the are all somewhat aligned.
Now I'm under no illusion that I can get all three perfectly the same, however if I could just them similar I would be happen.
For example; hdpi text to fit in the card, and mdpi to us up a bit more space.
How do you design application for multiple dpi/resolution?
Theme:
textTheme: TextTheme(
title: TextStyle(fontSize: 24.0, height: 1.0, color: Theme.of(context).primaryColor),
headline: TextStyle(fontSize: 18.0,height: 1.0, color: Colors.white),
subtitle: TextStyle(fontSize: 16.0,height: 1.0, color: Theme.of(context).primaryColor),
body1: TextStyle(fontSize: 12.0, height: 1.1, color: Colors.black87),
),
Button:
return RawMaterialButton(
child:
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 2.0,
color: Colors.grey,
offset: Offset(0.0, 6.0),
)
]),
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(5.0),
height: MediaQuery.of(context).size.height * 0.20,
width: MediaQuery.of(context).size.width * 0.95,
child: Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.85,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Padding(
padding: EdgeInsets.all(4.0),
child: Image.asset(
_buttonIcon,
height: MediaQuery.of(context).size.width * 0.06,
width: MediaQuery.of(context).size.width * 0.06,
color: Theme.of(context).primaryColor,
),
),
Padding(
padding: EdgeInsets.fromLTRB(4.0, 4.0, 4.0, 4.0),
child: Text(
_buttonTitle,
style: Theme.of(context).textTheme.subtitle,
),
),
],
),
Container(
child: Padding(
padding: EdgeInsets.all(4.0),
child: RichText(
maxLines: ((MediaQuery.of(context).size.height * 0.20) / Theme.of(context).textTheme.body1.fontSize).floor(),
overflow: TextOverflow.ellipsis,
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: _buttonText,
style: Theme.of(context).textTheme.body1),
],
),
),
),
),
],
),
),
Container(
child: Icon(
Icons.keyboard_arrow_right,
color: Theme.of(context).primaryColor,
),
),
],
),
),
onPressed: _onPressed,
);