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,21 +61,30 @@ 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: CustomCard(
padding: EdgeInsets.zero,
child: SizedBox(
height: 94.0,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
!app.isRooted ? const Spacer() : Container(), Expanded(
InkWell( child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.openApp(app), onTap: () => model.openApp(app),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.open_in_new_outlined, Icons.open_in_new_outlined,
color: color: Theme.of(context)
Theme.of(context).colorScheme.primary, .colorScheme
.primary,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
I18nText( I18nText(
@ -93,24 +102,35 @@ class AppInfoView extends StatelessWidget {
], ],
), ),
), ),
const Spacer(), ),
),
if (app.isRooted)
VerticalDivider( VerticalDivider(
color: Theme.of(context).canvasColor, color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
), ),
const Spacer(), if (app.isRooted)
InkWell( Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.showUninstallDialog( onTap: () => model.showUninstallDialog(
context, context,
app, app,
false, false,
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.delete_outline, Icons.delete_outline,
color: color: Theme.of(context)
Theme.of(context).colorScheme.primary, .colorScheme
.primary,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
I18nText( I18nText(
@ -128,23 +148,32 @@ class AppInfoView extends StatelessWidget {
], ],
), ),
), ),
const Spacer(), ),
),
VerticalDivider( VerticalDivider(
color: Theme.of(context).canvasColor, color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
), ),
const Spacer(), Expanded(
InkWell( child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () { onTap: () {
model.navigateToPatcher(app); model.navigateToPatcher(app);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.build_outlined, Icons.build_outlined,
color: color: Theme.of(context)
Theme.of(context).colorScheme.primary, .colorScheme
.primary,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
I18nText( 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, color: Theme.of(context).canvasColor,
) indent: 12.0,
: Container(), endIndent: 12.0,
app.isRooted ? const Spacer() : Container(), width: 1.0,
app.isRooted ),
? InkWell( if (app.isRooted)
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () => model.showUninstallDialog( onTap: () => model.showUninstallDialog(
context, context,
app, app,
@ -202,16 +236,18 @@ class AppInfoView extends StatelessWidget {
), ),
], ],
), ),
) ),
: Container(), ),
!app.isRooted ? const Spacer() : Container(), ),
], ],
), ),
), ),
), ),
),
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,9 +15,8 @@ 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>[
@ -70,7 +69,6 @@ class AppSelectorCard extends StatelessWidget {
), ),
], ],
), ),
),
); );
} }
} }

View File

@ -15,9 +15,8 @@ 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>[
@ -41,7 +40,6 @@ class PatchSelectorCard extends StatelessWidget {
: Text(_getPatchesSelection()), : Text(_getPatchesSelection()),
], ],
), ),
),
); );
} }

View File

@ -39,13 +39,11 @@ 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(
@ -105,8 +103,7 @@ class _PatchItemState extends State<PatchItem> {
Padding( Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: TextButton.icon( child: TextButton.icon(
label: label: I18nText('patchItem.unsupportedWarningButton'),
I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning), icon: const Icon(Icons.warning),
onPressed: () => _showUnsupportedWarningDialog(), onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle( 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), 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,
borderRadius: BorderRadius.circular(16),
color: isFilled color: isFilled
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.40) ? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
: Colors.transparent, : Colors.transparent,
border: isFilled borderRadius: BorderRadius.circular(16),
? null child: InkWell(
: Border.all( onTap: onTap,
width: 1, borderRadius: BorderRadius.circular(16),
color: Theme.of(context).colorScheme.secondary, child: Padding(
), padding: padding ?? const EdgeInsets.all(20.0),
),
padding: const EdgeInsets.all(20),
child: child, child: child,
),
),
); );
} }
} }