feat: dpi responsive layout (#361)

This commit is contained in:
BrentBoyMeBob 2023-08-03 14:38:38 -07:00 committed by GitHub
parent d3790bf64b
commit fe75b75ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 146 additions and 128 deletions

View File

@ -31,6 +31,8 @@ class InstallerView extends StatelessWidget {
style: GoogleFonts.inter( style: GoogleFonts.inter(
color: Theme.of(context).textTheme.titleLarge!.color, color: Theme.of(context).textTheme.titleLarge!.color,
), ),
maxLines: 1,
overflow: TextOverflow.ellipsis,
), ),
onBackButtonPressed: () => model.onWillPop(context), onBackButtonPressed: () => model.onWillPop(context),
actions: <Widget>[ actions: <Widget>[

View File

@ -62,13 +62,17 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
actions: [ actions: [
Container( FittedBox(
fit: BoxFit.scaleDown,
child: Container(
margin: const EdgeInsets.only(top: 12, bottom: 12), margin: const EdgeInsets.only(top: 12, bottom: 12),
padding: padding:
const EdgeInsets.symmetric(horizontal: 6, vertical: 6), const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Theme.of(context)
Theme.of(context).colorScheme.tertiary.withOpacity(0.5), .colorScheme
.tertiary
.withOpacity(0.5),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Text( child: Text(
@ -78,6 +82,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
), ),
), ),
), ),
),
CustomPopupMenu( CustomPopupMenu(
onSelected: (value) => {model.onMenuSelection(value)}, onSelected: (value) => {model.onMenuSelection(value)},
children: { children: {

View File

@ -70,7 +70,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
}, },
), ),
), ),
Row( Wrap(
children: [ children: [
I18nText( I18nText(
'suggested', 'suggested',
@ -84,8 +84,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
}, },
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Text(
child: Text(
widget.patchesCount == 1 widget.patchesCount == 1
? '${widget.patchesCount} patch' ? '${widget.patchesCount} patch'
: '${widget.patchesCount} patches', : '${widget.patchesCount} patches',
@ -95,7 +94,6 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
), ),
), ),
),
], ],
), ),
], ],

View File

@ -64,7 +64,7 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
), ),
), ),
), ),
Row( Wrap(
children: [ children: [
I18nText( I18nText(
'suggested', 'suggested',
@ -78,8 +78,7 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
}, },
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Text(
child: Text(
widget.patchesCount == 1 widget.patchesCount == 1
? '${widget.patchesCount} patch' ? '${widget.patchesCount} patch'
: '${widget.patchesCount} patches', : '${widget.patchesCount} patches',
@ -89,7 +88,6 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
), ),
), ),
),
], ],
), ),
], ],

View File

@ -30,21 +30,18 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
const Row( const Text('ReVanced Manager'),
children: <Widget>[
Text('ReVanced Manager'),
],
),
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
children: <Widget>[ children: <Widget>[
FutureBuilder<String?>( FutureBuilder<String?>(
future: model.getLatestManagerReleaseTime(), future: model.getLatestManagerReleaseTime(),
builder: (context, snapshot) => builder: (context, snapshot) => snapshot.hasData &&
snapshot.hasData && snapshot.data!.isNotEmpty snapshot.data!.isNotEmpty
? I18nText( ? I18nText(
'latestCommitCard.timeagoLabel', 'latestCommitCard.timeagoLabel',
translationParams: {'time': snapshot.data!}, translationParams: {'time': snapshot.data!},
@ -55,6 +52,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
), ),
], ],
), ),
),
FutureBuilder<bool>( FutureBuilder<bool>(
future: model.hasManagerUpdates(), future: model.hasManagerUpdates(),
initialData: false, initialData: false,
@ -82,14 +80,11 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
const Row( const Text('ReVanced Patches'),
children: <Widget>[
Text('ReVanced Patches'),
],
),
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
children: <Widget>[ children: <Widget>[
@ -112,6 +107,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
), ),
], ],
), ),
),
FutureBuilder<bool>( FutureBuilder<bool>(
future: locator<HomeViewModel>().hasPatchesUpdates(), future: locator<HomeViewModel>().hasPatchesUpdates(),
initialData: false, initialData: false,

View File

@ -49,10 +49,12 @@ class AppSelectorCard extends StatelessWidget {
), ),
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
Text( Flexible(
child: Text(
locator<PatcherViewModel>().getAppSelectionString(), locator<PatcherViewModel>().getAppSelectionString(),
style: const TextStyle(fontWeight: FontWeight.w600), style: const TextStyle(fontWeight: FontWeight.w600),
), ),
),
], ],
), ),
if (locator<PatcherViewModel>().selectedApp == null) if (locator<PatcherViewModel>().selectedApp == null)

View File

@ -70,34 +70,49 @@ class _ApplicationItemState extends State<ApplicationItem>
animationDuration: Duration(milliseconds: 450), animationDuration: Duration(milliseconds: 450),
), ),
header: Row( header: Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Row(
children: [
SizedBox( SizedBox(
width: 40, width: 40,
child: Image.memory(widget.icon, height: 40, width: 40), child: Image.memory(widget.icon, height: 40, width: 40),
), ),
const SizedBox(width: 4), const SizedBox(width: 19),
Padding( Expanded(
padding: const EdgeInsets.only(left: 15.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
widget.name.length > 12 widget.name,
? '${widget.name.substring(0, 12)}...' maxLines: 1,
: widget.name, overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(
format(widget.patchDate),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
Text(format(widget.patchDate)),
], ],
), ),
), ),
const Spacer(), ],
),
),
Row(
children: [
RotationTransition( RotationTransition(
turns: turns: Tween(begin: 0.0, end: 0.50)
Tween(begin: 0.0, end: 0.50).animate(_animationController), .animate(_animationController),
child: const Padding( child: const Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Icon(Icons.arrow_drop_down), child: Icon(Icons.arrow_drop_down),
@ -118,6 +133,8 @@ class _ApplicationItemState extends State<ApplicationItem>
), ),
], ],
), ),
],
),
collapsed: const SizedBox(), collapsed: const SizedBox(),
expanded: Padding( expanded: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(