Skip to content

Commit

Permalink
Merge pull request #11 from arafaysaleem/ui-fixes
Browse files Browse the repository at this point in the history
UI font scaling fixes
  • Loading branch information
arafaysaleem authored Jul 4, 2020
2 parents ced1a94 + 51a9c71 commit ecb498a
Show file tree
Hide file tree
Showing 15 changed files with 364 additions and 240 deletions.
6 changes: 6 additions & 0 deletions lib/screens/credits_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class CreditsScreen extends StatelessWidget {
fontWeight: FontWeight.w600,
color: Colors.black,
),
maxLines: 1,
maxFontSize: 25,
),

Expand All @@ -105,6 +106,7 @@ class CreditsScreen extends StatelessWidget {
color: Color(0xff009a88),
),
maxFontSize: 18,
maxLines: 1,
),

SizedBox(height: 10),
Expand All @@ -130,6 +132,7 @@ class CreditsScreen extends StatelessWidget {
color: Colors.white,
),
maxFontSize: 18,
maxLines: 1,
),
),
)
Expand Down Expand Up @@ -202,6 +205,7 @@ class CreditsScreen extends StatelessWidget {
color: Colors.black,
),
maxFontSize: 15,
maxLines: 1,
),
const Icon(
Icons.favorite,
Expand All @@ -217,6 +221,7 @@ class CreditsScreen extends StatelessWidget {
color: Colors.black,
),
maxFontSize: 15,
maxLines: 1,
),
AutoSizeText(
"Abdur Rafay Saleem",
Expand All @@ -227,6 +232,7 @@ class CreditsScreen extends StatelessWidget {
color: Colors.black,
),
maxFontSize: 15,
maxLines: 1,
),
SizedBox(width: 5),
Image(
Expand Down
4 changes: 3 additions & 1 deletion lib/screens/myths_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class MythsScreen extends StatelessWidget {
fontSize: 31,
fontWeight: FontWeight.w700,
),
stepGranularity: 2,
stepGranularity: 1,
maxFontSize: 31,
maxLines: 1,
),
),
),
Expand Down
4 changes: 3 additions & 1 deletion lib/screens/precautions_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class _PrecautionsScreenState extends State<PrecautionsScreen> {
fontSize: 31,
fontWeight: FontWeight.w700,
),
stepGranularity: 2,
maxLines: 1,
maxFontSize: 31,
stepGranularity: 1,
),
),
),
Expand Down
4 changes: 3 additions & 1 deletion lib/screens/symptoms_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class _SymptomsScreenState extends State<SymptomsScreen> {
fontSize: 31,
fontWeight: FontWeight.w700,
),
stepGranularity: 2,
maxFontSize: 31,
maxLines: 1,
stepGranularity: 1,
),
),
),
Expand Down
130 changes: 76 additions & 54 deletions lib/screens/updates_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,20 @@ class _UpdatesScreenState extends State<UpdatesScreen> {
//Sort by
Padding(
padding: MediaQuery.of(context).size.width>360.0? EdgeInsets.only(left: 20):EdgeInsets.only(left: 0),
child: AutoSizeText(
"Sort By",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 18,
color: Colors.black,
fontWeight: FontWeight.w600,
child: SizedBox(
width: 68,
child: AutoSizeText(
"Sort By",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 18,
color: Colors.black,
fontWeight: FontWeight.w600,
),
stepGranularity: 2,
maxFontSize: 18,
maxLines: 1,
),
stepGranularity: 2,
maxFontSize: 18,
),
),

Expand Down Expand Up @@ -164,72 +168,90 @@ class _UpdatesScreenState extends State<UpdatesScreen> {
items: <DropdownMenuItem<String>>[
const DropdownMenuItem(
value: "publishedAt",
child: AutoSizeText(
"Latest",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
child: SizedBox(
width: 55,
child: AutoSizeText(
"Latest",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
stepGranularity: 1,
maxFontSize: 17,
),
stepGranularity: 1,
maxFontSize: 17,
),
),
const DropdownMenuItem(
value: "popular",
child: AutoSizeText(
"Popular",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
child: SizedBox(
width: 68,
child: AutoSizeText(
"Popular",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
stepGranularity: 1,
maxFontSize: 17,
),
stepGranularity: 1,
maxFontSize: 17,
),
),
const DropdownMenuItem(
value: "Last Week",
child: AutoSizeText(
"Last Week",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
child: SizedBox(
width: 90,
child: AutoSizeText(
"Last Week",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
stepGranularity: 1,
maxFontSize: 17,
maxLines: 1,
),
stepGranularity: 1,
maxFontSize: 17,
),
),
const DropdownMenuItem(
value: "Last 15",
child: AutoSizeText(
"Last 15 days",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
child: SizedBox(
width: 99,
child: AutoSizeText(
"Last 15 days",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
stepGranularity: 1,
maxFontSize: 17,
maxLines: 1,
),
stepGranularity: 1,
maxFontSize: 17,
),
),
const DropdownMenuItem(
value: "Last Month",
child: AutoSizeText(
"Last Month",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
child: SizedBox(
width: 97,
child: AutoSizeText(
"Last Month",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500,
),
stepGranularity: 1,
maxFontSize: 17,
maxLines: 1,
),
stepGranularity: 1,
maxFontSize: 17,
),
),
],
Expand Down
106 changes: 60 additions & 46 deletions lib/screens/virus_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ class VirusDetailsScreen extends StatelessWidget {
},
];

static AutoSizeGroup titleGrp = AutoSizeGroup();
static AutoSizeGroup descGrp = AutoSizeGroup();

const VirusDetailsScreen({Key key, this.imgPath, this.color})
: super(key: key);

@override
Widget build(BuildContext context) {
double pageHeight = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.grey[100],
extendBodyBehindAppBar: true,
Expand All @@ -70,7 +74,7 @@ class VirusDetailsScreen extends StatelessWidget {
elevation: 0,
),
body: Container(
height: MediaQuery.of(context).size.height,
height: pageHeight,
child: Column(
children: <Widget>[
//image tag container
Expand Down Expand Up @@ -103,6 +107,8 @@ class VirusDetailsScreen extends StatelessWidget {
fontWeight: FontWeight.w700,
),
stepGranularity: 2,
maxFontSize: 30,
maxLines: 1,
),
),
),
Expand Down Expand Up @@ -130,54 +136,62 @@ class VirusDetailsScreen extends StatelessWidget {
),

//Details List
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(25, 20, 25, 0),
child: ListView.builder(
physics: BouncingScrollPhysics(),
padding: const EdgeInsets.all(0),
scrollDirection: Axis.vertical,
itemCount: details.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
AutoSizeText(
"${details[index]["detail"]}",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 28,
fontFamily: "Montserrat",
color: color,
fontWeight: FontWeight.w700,
Container(
height: pageHeight - 220,
padding: const EdgeInsets.fromLTRB(25, 20, 25, 0),
child: ListView.builder(
physics: BouncingScrollPhysics(),
padding: const EdgeInsets.all(0),
scrollDirection: Axis.vertical,
itemCount: details.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: LayoutBuilder(
builder: (ctx, constraint) => LimitedBox(
maxWidth: constraint.maxWidth,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
AutoSizeText(
"${details[index]["detail"]}",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 28,
fontFamily: "Montserrat",
color: color,
fontWeight: FontWeight.w700,
),
maxFontSize: 28,
stepGranularity: 2,
maxLines: 3,
group: titleGrp,
),
maxFontSize: 28,
stepGranularity: 2,
),
SizedBox(
height: 10,
),
AutoSizeText(
"${details[index]['desc']}",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 18,
height: 1.5,
fontFamily: "Montserrat",
color: Colors.grey[850],
fontWeight: FontWeight.w500,
SizedBox(
height: 10,
),
maxFontSize: 18,
stepGranularity: 2,
),
],
AutoSizeText(
"${details[index]['desc']}",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 18,
height: 1.5,
fontFamily: "Montserrat",
color: Colors.grey[850],
letterSpacing: 0.5,
fontWeight: FontWeight.w500,
),
maxFontSize: 18,
group: descGrp,
stepGranularity: 2,
),
],
),
),
);
},
),
),
);
},
),
)
],
Expand Down
Loading

0 comments on commit ecb498a

Please sign in to comment.