fix: make inkwells visible (#205)

This commit is contained in:
Unknown 2022-09-19 18:55:44 +02:00 committed by GitHub
parent efcf455b24
commit 530dd78752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 349 additions and 317 deletions

View File

@ -88,16 +88,14 @@ class _AppSelectorViewState extends State<AppSelectorView> {
child: Column( child: Column(
children: model children: model
.getFilteredApps(_query) .getFilteredApps(_query)
.map((app) => InkWell( .map((app) => InstalledAppItem(
name: app.appName,
pkgName: app.packageName,
icon: app.icon,
onTap: () { onTap: () {
model.selectApp(app); model.selectApp(app);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: InstalledAppItem(
name: app.appName,
pkgName: app.packageName,
icon: app.icon,
),
)) ))
.toList(), .toList(),
), ),

View File

@ -34,7 +34,7 @@ class AppInfoView extends StatelessWidget {
), ),
), ),
SliverPadding( SliverPadding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.symmetric(vertical: 20.0),
sliver: SliverList( sliver: SliverList(
delegate: SliverChildListDelegate.fixed( delegate: SliverChildListDelegate.fixed(
<Widget>[ <Widget>[
@ -61,135 +61,34 @@ class AppInfoView extends StatelessWidget {
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.subtitle1,
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
CustomCard( Padding(
child: IntrinsicHeight( padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Row( child: CustomCard(
mainAxisAlignment: MainAxisAlignment.center, padding: EdgeInsets.zero,
children: <Widget>[ child: SizedBox(
!app.isRooted ? const Spacer() : Container(), height: 94.0,
InkWell( child: Row(
onTap: () => model.openApp(app), mainAxisAlignment: MainAxisAlignment.center,
child: Column( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.center, Expanded(
children: <Widget>[ child: Material(
Icon( type: MaterialType.transparency,
Icons.open_in_new_outlined, child: InkWell(
color: borderRadius: BorderRadius.circular(16.0),
Theme.of(context).colorScheme.primary, onTap: () => model.openApp(app),
),
const SizedBox(height: 10),
I18nText(
'appInfoView.openButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
const Spacer(),
VerticalDivider(
color: Theme.of(context).canvasColor,
),
const Spacer(),
InkWell(
onTap: () => model.showUninstallDialog(
context,
app,
false,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.delete_outline,
color:
Theme.of(context).colorScheme.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.uninstallButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
const Spacer(),
VerticalDivider(
color: Theme.of(context).canvasColor,
),
const Spacer(),
InkWell(
onTap: () {
model.navigateToPatcher(app);
Navigator.of(context).pop();
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.build_outlined,
color:
Theme.of(context).colorScheme.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.patchButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
app.isRooted ? const Spacer() : Container(),
app.isRooted
? VerticalDivider(
color: Theme.of(context).canvasColor,
)
: Container(),
app.isRooted ? const Spacer() : Container(),
app.isRooted
? InkWell(
onTap: () => model.showUninstallDialog(
context,
app,
true,
),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons Icons.open_in_new_outlined,
.settings_backup_restore_outlined,
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.primary, .primary,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
I18nText( I18nText(
'appInfoView.unpatchButton', 'appInfoView.openButton',
child: Text( child: Text(
'', '',
style: TextStyle( style: TextStyle(
@ -202,16 +101,153 @@ class AppInfoView extends StatelessWidget {
), ),
], ],
), ),
) ),
: Container(), ),
!app.isRooted ? const Spacer() : Container(), ),
], if (app.isRooted)
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
if (app.isRooted)
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.showUninstallDialog(
context,
app,
false,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.delete_outline,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.uninstallButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
),
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () {
model.navigateToPatcher(app);
Navigator.of(context).pop();
},
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.build_outlined,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.patchButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
),
if (app.isRooted)
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
if (app.isRooted)
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () => model.showUninstallDialog(
context,
app,
true,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons
.settings_backup_restore_outlined,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.unpatchButton',
child: Text(
'',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
),
],
),
), ),
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText( title: I18nText(
'appInfoView.packageNameLabel', 'appInfoView.packageNameLabel',
child: const Text( child: const Text(
@ -226,7 +262,8 @@ class AppInfoView extends StatelessWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText( title: I18nText(
'appInfoView.installTypeLabel', 'appInfoView.installTypeLabel',
child: const Text( child: const Text(
@ -243,7 +280,8 @@ class AppInfoView extends StatelessWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText( title: I18nText(
'appInfoView.patchedDateLabel', 'appInfoView.patchedDateLabel',
child: const Text( child: const Text(
@ -264,7 +302,8 @@ class AppInfoView extends StatelessWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
ListTile( ListTile(
contentPadding: EdgeInsets.zero, contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText( title: I18nText(
'appInfoView.appliedPatchesLabel', 'appInfoView.appliedPatchesLabel',
child: const Text( child: const Text(

View File

@ -6,12 +6,14 @@ class InstalledAppItem extends StatefulWidget {
final String name; final String name;
final String pkgName; final String pkgName;
final Uint8List icon; final Uint8List icon;
final Function()? onTap;
const InstalledAppItem({ const InstalledAppItem({
Key? key, Key? key,
required this.name, required this.name,
required this.pkgName, required this.pkgName,
required this.icon, required this.icon,
this.onTap,
}) : super(key: key); }) : super(key: key);
@override @override
@ -24,6 +26,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0), padding: const EdgeInsets.symmetric(vertical: 4.0),
child: CustomCard( child: CustomCard(
onTap: widget.onTap,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[

View File

@ -15,61 +15,59 @@ class AppSelectorCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return CustomCard(
onTap: onPressed, onTap: onPressed,
child: CustomCard( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ I18nText(
I18nText( locator<PatcherViewModel>().selectedApp == null
locator<PatcherViewModel>().selectedApp == null ? 'appSelectorCard.widgetTitle'
? 'appSelectorCard.widgetTitle' : 'appSelectorCard.widgetTitleSelected',
: 'appSelectorCard.widgetTitleSelected', child: const Text(
child: const Text( '',
'', style: TextStyle(
style: TextStyle( fontSize: 18,
fontSize: 18, fontWeight: FontWeight.w500,
fontWeight: FontWeight.w500,
),
), ),
), ),
const SizedBox(height: 10), ),
locator<PatcherViewModel>().selectedApp == null const SizedBox(height: 10),
? I18nText('appSelectorCard.widgetSubtitle') locator<PatcherViewModel>().selectedApp == null
: Row( ? I18nText('appSelectorCard.widgetSubtitle')
children: <Widget>[ : Row(
SizedBox( children: <Widget>[
height: 18.0, SizedBox(
child: ClipOval( height: 18.0,
child: Image.memory( child: ClipOval(
locator<PatcherViewModel>().selectedApp == null child: Image.memory(
? Uint8List(0) locator<PatcherViewModel>().selectedApp == null
: locator<PatcherViewModel>().selectedApp!.icon, ? Uint8List(0)
fit: BoxFit.cover, : locator<PatcherViewModel>().selectedApp!.icon,
), fit: BoxFit.cover,
), ),
), ),
const SizedBox(width: 6), ),
Text(locator<PatcherViewModel>().getAppSelectionString()), const SizedBox(width: 6),
], Text(locator<PatcherViewModel>().getAppSelectionString()),
), ],
locator<PatcherViewModel>().selectedApp == null ),
? Container() locator<PatcherViewModel>().selectedApp == null
: Column( ? Container()
children: [ : Column(
const SizedBox(height: 10), children: [
Padding( const SizedBox(height: 10),
padding: const EdgeInsets.only(left: 20), Padding(
child: Text( padding: const EdgeInsets.only(left: 20),
locator<PatcherViewModel>() child: Text(
.getRecommendedVersionString(context), locator<PatcherViewModel>()
style: const TextStyle(fontStyle: FontStyle.italic), .getRecommendedVersionString(context),
), style: const TextStyle(fontStyle: FontStyle.italic),
), ),
], ),
), ],
], ),
), ],
), ),
); );
} }

View File

@ -15,32 +15,30 @@ class PatchSelectorCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return CustomCard(
onTap: onPressed, onTap: onPressed,
child: CustomCard( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ I18nText(
I18nText( locator<PatcherViewModel>().selectedPatches.isEmpty
locator<PatcherViewModel>().selectedPatches.isEmpty ? 'patchSelectorCard.widgetTitle'
? 'patchSelectorCard.widgetTitle' : 'patchSelectorCard.widgetTitleSelected',
: 'patchSelectorCard.widgetTitleSelected', child: const Text(
child: const Text( '',
'', style: TextStyle(
style: TextStyle( fontSize: 18,
fontSize: 18, fontWeight: FontWeight.w500,
fontWeight: FontWeight.w500,
),
), ),
), ),
const SizedBox(height: 10), ),
locator<PatcherViewModel>().selectedApp == null const SizedBox(height: 10),
? I18nText('patchSelectorCard.widgetSubtitle') locator<PatcherViewModel>().selectedApp == null
: locator<PatcherViewModel>().selectedPatches.isEmpty ? I18nText('patchSelectorCard.widgetSubtitle')
? I18nText('patchSelectorCard.widgetEmptySubtitle') : locator<PatcherViewModel>().selectedPatches.isEmpty
: Text(_getPatchesSelection()), ? I18nText('patchSelectorCard.widgetEmptySubtitle')
], : Text(_getPatchesSelection()),
), ],
), ),
); );
} }

View File

@ -39,102 +39,98 @@ class _PatchItemState extends State<PatchItem> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0), padding: const EdgeInsets.symmetric(vertical: 4.0),
child: InkWell( child: CustomCard(
borderRadius: BorderRadius.circular(16),
onTap: () { onTap: () {
setState(() => widget.isSelected = !widget.isSelected); setState(() => widget.isSelected = !widget.isSelected);
widget.onChanged(widget.isSelected); widget.onChanged(widget.isSelected);
}, },
child: CustomCard( child: Column(
child: Column( children: <Widget>[
children: <Widget>[ Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
children: <Widget>[ Flexible(
Flexible( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Row(
Row( crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[
children: <Widget>[ Text(
Text( widget.simpleName,
widget.simpleName, style: const TextStyle(
style: const TextStyle( fontSize: 16,
fontSize: 16, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w600,
),
), ),
const SizedBox(width: 4), ),
Text(widget.version) const SizedBox(width: 4),
], Text(widget.version)
), ],
const SizedBox(height: 4),
Text(
widget.description,
softWrap: true,
maxLines: 3,
overflow: TextOverflow.visible,
style: const TextStyle(fontSize: 14),
),
],
),
),
Transform.scale(
scale: 1.2,
child: Checkbox(
value: widget.isSelected,
activeColor: Theme.of(context).colorScheme.primary,
checkColor:
Theme.of(context).colorScheme.secondaryContainer,
side: BorderSide(
width: 2.0,
color: Theme.of(context).colorScheme.primary,
), ),
onChanged: (newValue) { const SizedBox(height: 4),
setState(() => widget.isSelected = newValue!); Text(
widget.onChanged(widget.isSelected); widget.description,
}, softWrap: true,
maxLines: 3,
overflow: TextOverflow.visible,
style: const TextStyle(fontSize: 14),
),
],
),
),
Transform.scale(
scale: 1.2,
child: Checkbox(
value: widget.isSelected,
activeColor: Theme.of(context).colorScheme.primary,
checkColor:
Theme.of(context).colorScheme.secondaryContainer,
side: BorderSide(
width: 2.0,
color: Theme.of(context).colorScheme.primary,
), ),
) onChanged: (newValue) {
], setState(() => widget.isSelected = newValue!);
), widget.onChanged(widget.isSelected);
widget.isUnsupported },
? Row( ),
children: <Widget>[ )
Padding( ],
padding: const EdgeInsets.only(top: 8), ),
child: TextButton.icon( widget.isUnsupported
label: ? Row(
I18nText('patchItem.unsupportedWarningButton'), children: <Widget>[
icon: const Icon(Icons.warning), Padding(
onPressed: () => _showUnsupportedWarningDialog(), padding: const EdgeInsets.only(top: 8),
style: ButtonStyle( child: TextButton.icon(
shape: MaterialStateProperty.all( label: I18nText('patchItem.unsupportedWarningButton'),
RoundedRectangleBorder( icon: const Icon(Icons.warning),
borderRadius: BorderRadius.circular(12), onPressed: () => _showUnsupportedWarningDialog(),
side: BorderSide( style: ButtonStyle(
width: 1, shape: MaterialStateProperty.all(
color: RoundedRectangleBorder(
Theme.of(context).colorScheme.secondary, borderRadius: BorderRadius.circular(12),
), side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
), ),
), ),
backgroundColor: MaterialStateProperty.all( ),
Colors.transparent, backgroundColor: MaterialStateProperty.all(
), Colors.transparent,
foregroundColor: MaterialStateProperty.all( ),
Theme.of(context).colorScheme.secondary, foregroundColor: MaterialStateProperty.all(
), Theme.of(context).colorScheme.secondary,
), ),
), ),
), ),
], ),
) ],
: Container(), )
widget.child ?? const SizedBox(), : Container(),
], widget.child ?? const SizedBox(),
), ],
), ),
), ),
); );

View File

@ -61,6 +61,12 @@ class _ApplicationItemState extends State<ApplicationItem>
animationDuration: Duration(milliseconds: 450), animationDuration: Duration(milliseconds: 450),
), ),
header: CustomCard( header: CustomCard(
onTap: () {
expController.toggle();
_animationController.isCompleted
? _animationController.reverse()
: _animationController.forward();
},
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
@ -87,20 +93,11 @@ class _ApplicationItemState extends State<ApplicationItem>
), ),
), ),
const Spacer(), const Spacer(),
Padding( RotationTransition(
padding: const EdgeInsets.only(right: 5.0), turns: Tween(begin: 0.0, end: 0.50).animate(_animationController),
child: RotationTransition( child: const Padding(
turns: padding: EdgeInsets.all(8.0),
Tween(begin: 0.0, end: 0.50).animate(_animationController), child: Icon(Icons.arrow_drop_down),
child: IconButton(
onPressed: () {
expController.toggle();
_animationController.isCompleted
? _animationController.reverse()
: _animationController.forward();
},
icon: const Icon(Icons.arrow_drop_down),
),
), ),
), ),
Column( Column(
@ -118,7 +115,7 @@ class _ApplicationItemState extends State<ApplicationItem>
], ],
), ),
), ),
collapsed: const Text(''), collapsed: const SizedBox(),
expanded: Padding( expanded: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Column( child: Column(

View File

@ -3,30 +3,33 @@ import 'package:flutter/material.dart';
class CustomCard extends StatelessWidget { class CustomCard extends StatelessWidget {
final bool isFilled; final bool isFilled;
final Widget child; final Widget child;
final Function()? onTap;
final EdgeInsetsGeometry? padding;
const CustomCard({ const CustomCard({
Key? key, Key? key,
this.isFilled = true, this.isFilled = true,
required this.child, required this.child,
this.onTap,
this.padding,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Material(
decoration: BoxDecoration( type: isFilled ? MaterialType.card : MaterialType.transparency,
color: isFilled
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
: Colors.transparent,
borderRadius: BorderRadius.circular(16),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
color: isFilled child: Padding(
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.40) padding: padding ?? const EdgeInsets.all(20.0),
: Colors.transparent, child: child,
border: isFilled ),
? null
: Border.all(
width: 1,
color: Theme.of(context).colorScheme.secondary,
),
), ),
padding: const EdgeInsets.all(20),
child: child,
); );
} }
} }