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,19 +62,24 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
actions: [ actions: [
Container( FittedBox(
margin: const EdgeInsets.only(top: 12, bottom: 12), fit: BoxFit.scaleDown,
padding: child: Container(
const EdgeInsets.symmetric(horizontal: 6, vertical: 6), margin: const EdgeInsets.only(top: 12, bottom: 12),
decoration: BoxDecoration( padding:
color: const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
Theme.of(context).colorScheme.tertiary.withOpacity(0.5), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), color: Theme.of(context)
), .colorScheme
child: Text( .tertiary
model.patchesVersion!, .withOpacity(0.5),
style: TextStyle( borderRadius: BorderRadius.circular(6),
color: Theme.of(context).textTheme.titleLarge!.color, ),
child: Text(
model.patchesVersion!,
style: TextStyle(
color: Theme.of(context).textTheme.titleLarge!.color,
),
), ),
), ),
), ),

View File

@ -70,7 +70,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
}, },
), ),
), ),
Row( Wrap(
children: [ children: [
I18nText( I18nText(
'suggested', 'suggested',
@ -84,16 +84,14 @@ 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', maxLines: 1,
maxLines: 1, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, style: TextStyle(
style: TextStyle( 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,16 +78,14 @@ 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', maxLines: 1,
maxLines: 1, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, style: TextStyle(
style: TextStyle( color: Theme.of(context).colorScheme.secondary,
color: Theme.of(context).colorScheme.secondary,
),
), ),
), ),
], ],

View File

@ -30,30 +30,28 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
const Row( children: <Widget>[
children: <Widget>[ const Text('ReVanced Manager'),
Text('ReVanced Manager'), const SizedBox(height: 4),
], Row(
), children: <Widget>[
const SizedBox(height: 4), FutureBuilder<String?>(
Row( future: model.getLatestManagerReleaseTime(),
children: <Widget>[ builder: (context, snapshot) => snapshot.hasData &&
FutureBuilder<String?>( snapshot.data!.isNotEmpty
future: model.getLatestManagerReleaseTime(), ? I18nText(
builder: (context, snapshot) => 'latestCommitCard.timeagoLabel',
snapshot.hasData && snapshot.data!.isNotEmpty translationParams: {'time': snapshot.data!},
? I18nText( )
'latestCommitCard.timeagoLabel', : I18nText('latestCommitCard.loadingLabel'),
translationParams: {'time': snapshot.data!}, ),
) ],
: I18nText('latestCommitCard.loadingLabel'), ),
), ],
], ),
),
],
), ),
FutureBuilder<bool>( FutureBuilder<bool>(
future: model.hasManagerUpdates(), future: model.hasManagerUpdates(),
@ -82,35 +80,33 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
const Row( children: <Widget>[
children: <Widget>[ const Text('ReVanced Patches'),
Text('ReVanced Patches'), const SizedBox(height: 4),
], Row(
), children: <Widget>[
const SizedBox(height: 4), FutureBuilder<String?>(
Row( future: model.getLatestPatchesReleaseTime(),
children: <Widget>[ builder: (context, snapshot) => Text(
FutureBuilder<String?>( snapshot.hasData && snapshot.data!.isNotEmpty
future: model.getLatestPatchesReleaseTime(), ? FlutterI18n.translate(
builder: (context, snapshot) => Text( context,
snapshot.hasData && snapshot.data!.isNotEmpty 'latestCommitCard.timeagoLabel',
? FlutterI18n.translate( translationParams: {'time': snapshot.data!},
context, )
'latestCommitCard.timeagoLabel', : FlutterI18n.translate(
translationParams: {'time': snapshot.data!}, context,
) 'latestCommitCard.loadingLabel',
: FlutterI18n.translate( ),
context, ),
'latestCommitCard.loadingLabel',
),
), ),
), ],
], ),
), ],
], ),
), ),
FutureBuilder<bool>( FutureBuilder<bool>(
future: locator<HomeViewModel>().hasPatchesUpdates(), future: locator<HomeViewModel>().hasPatchesUpdates(),

View File

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

View File

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