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(
children: model
.getFilteredApps(_query)
.map((app) => InkWell(
.map((app) => InstalledAppItem(
name: app.appName,
pkgName: app.packageName,
icon: app.icon,
onTap: () {
model.selectApp(app);
Navigator.of(context).pop();
},
child: InstalledAppItem(
name: app.appName,
pkgName: app.packageName,
icon: app.icon,
),
))
.toList(),
),

View File

@ -34,7 +34,7 @@ class AppInfoView extends StatelessWidget {
),
),
SliverPadding(
padding: const EdgeInsets.all(20.0),
padding: const EdgeInsets.symmetric(vertical: 20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
@ -61,135 +61,34 @@ class AppInfoView extends StatelessWidget {
style: Theme.of(context).textTheme.subtitle1,
),
const SizedBox(height: 20),
CustomCard(
child: IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
!app.isRooted ? const Spacer() : Container(),
InkWell(
onTap: () => model.openApp(app),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.open_in_new_outlined,
color:
Theme.of(context).colorScheme.primary,
),
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,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: CustomCard(
padding: EdgeInsets.zero,
child: SizedBox(
height: 94.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.openApp(app),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons
.settings_backup_restore_outlined,
Icons.open_in_new_outlined,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
'appInfoView.unpatchButton',
'appInfoView.openButton',
child: Text(
'',
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),
ListTile(
contentPadding: EdgeInsets.zero,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'appInfoView.packageNameLabel',
child: const Text(
@ -226,7 +262,8 @@ class AppInfoView extends StatelessWidget {
),
const SizedBox(height: 4),
ListTile(
contentPadding: EdgeInsets.zero,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'appInfoView.installTypeLabel',
child: const Text(
@ -243,7 +280,8 @@ class AppInfoView extends StatelessWidget {
),
const SizedBox(height: 4),
ListTile(
contentPadding: EdgeInsets.zero,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'appInfoView.patchedDateLabel',
child: const Text(
@ -264,7 +302,8 @@ class AppInfoView extends StatelessWidget {
),
const SizedBox(height: 4),
ListTile(
contentPadding: EdgeInsets.zero,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'appInfoView.appliedPatchesLabel',
child: const Text(

View File

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

View File

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

View File

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

View File

@ -39,102 +39,98 @@ class _PatchItemState extends State<PatchItem> {
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: InkWell(
borderRadius: BorderRadius.circular(16),
child: CustomCard(
onTap: () {
setState(() => widget.isSelected = !widget.isSelected);
widget.onChanged(widget.isSelected);
},
child: CustomCard(
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
widget.simpleName,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
widget.simpleName,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
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,
),
const SizedBox(width: 4),
Text(widget.version)
],
),
onChanged: (newValue) {
setState(() => widget.isSelected = newValue!);
widget.onChanged(widget.isSelected);
},
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,
),
)
],
),
widget.isUnsupported
? Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 8),
child: TextButton.icon(
label:
I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
),
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(
label: I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
width: 1,
color:
Theme.of(context).colorScheme.secondary,
),
),
backgroundColor: MaterialStateProperty.all(
Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.secondary,
),
),
backgroundColor: MaterialStateProperty.all(
Colors.transparent,
),
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),
),
header: CustomCard(
onTap: () {
expController.toggle();
_animationController.isCompleted
? _animationController.reverse()
: _animationController.forward();
},
child: Row(
children: <Widget>[
SizedBox(
@ -87,20 +93,11 @@ class _ApplicationItemState extends State<ApplicationItem>
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(right: 5.0),
child: RotationTransition(
turns:
Tween(begin: 0.0, end: 0.50).animate(_animationController),
child: IconButton(
onPressed: () {
expController.toggle();
_animationController.isCompleted
? _animationController.reverse()
: _animationController.forward();
},
icon: const Icon(Icons.arrow_drop_down),
),
RotationTransition(
turns: Tween(begin: 0.0, end: 0.50).animate(_animationController),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.arrow_drop_down),
),
),
Column(
@ -118,7 +115,7 @@ class _ApplicationItemState extends State<ApplicationItem>
],
),
),
collapsed: const Text(''),
collapsed: const SizedBox(),
expanded: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Column(

View File

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