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,21 +61,30 @@ class AppInfoView extends StatelessWidget {
style: Theme.of(context).textTheme.subtitle1,
),
const SizedBox(height: 20),
CustomCard(
child: IntrinsicHeight(
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>[
!app.isRooted ? const Spacer() : Container(),
InkWell(
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.openApp(app),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.open_in_new_outlined,
color:
Theme.of(context).colorScheme.primary,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
@ -93,24 +102,35 @@ class AppInfoView extends StatelessWidget {
],
),
),
const Spacer(),
),
),
if (app.isRooted)
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
const Spacer(),
InkWell(
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,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.delete_outline,
color:
Theme.of(context).colorScheme.primary,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
@ -128,23 +148,32 @@ class AppInfoView extends StatelessWidget {
],
),
),
const Spacer(),
),
),
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
const Spacer(),
InkWell(
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,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.build_outlined,
color:
Theme.of(context).colorScheme.primary,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
I18nText(
@ -162,15 +191,20 @@ class AppInfoView extends StatelessWidget {
],
),
),
app.isRooted ? const Spacer() : Container(),
app.isRooted
? VerticalDivider(
),
),
if (app.isRooted)
VerticalDivider(
color: Theme.of(context).canvasColor,
)
: Container(),
app.isRooted ? const Spacer() : Container(),
app.isRooted
? InkWell(
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,
@ -202,16 +236,18 @@ class AppInfoView extends StatelessWidget {
),
],
),
)
: Container(),
!app.isRooted ? const Spacer() : Container(),
),
),
),
],
),
),
),
),
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,9 +15,8 @@ class AppSelectorCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
return CustomCard(
onTap: onPressed,
child: CustomCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -70,7 +69,6 @@ class AppSelectorCard extends StatelessWidget {
),
],
),
),
);
}
}

View File

@ -15,9 +15,8 @@ class PatchSelectorCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
return CustomCard(
onTap: onPressed,
child: CustomCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -41,7 +40,6 @@ class PatchSelectorCard extends StatelessWidget {
: Text(_getPatchesSelection()),
],
),
),
);
}

View File

@ -39,13 +39,11 @@ 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(
@ -105,8 +103,7 @@ class _PatchItemState extends State<PatchItem> {
Padding(
padding: const EdgeInsets.only(top: 8),
child: TextButton.icon(
label:
I18nText('patchItem.unsupportedWarningButton'),
label: I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle(
@ -136,7 +133,6 @@ class _PatchItemState extends State<PatchItem> {
],
),
),
),
);
}

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(
borderRadius: BorderRadius.circular(16),
return Material(
type: isFilled ? MaterialType.card : MaterialType.transparency,
color: isFilled
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.40)
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
: Colors.transparent,
border: isFilled
? null
: Border.all(
width: 1,
color: Theme.of(context).colorScheme.secondary,
),
),
padding: const EdgeInsets.all(20),
borderRadius: BorderRadius.circular(16),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(16),
child: Padding(
padding: padding ?? const EdgeInsets.all(20.0),
child: child,
),
),
);
}
}