fix: move changelog into app item custom card (#294)

This commit is contained in:
afn 2022-09-24 14:49:02 -04:00 committed by GitHub
parent 6ac901f1d6
commit 6d1427e01e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,93 +50,94 @@ class _ApplicationItemState extends State<ApplicationItem>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ExpandableController expController = ExpandableController(); ExpandableController expController = ExpandableController();
return ExpandablePanel( return Container(
controller: expController, margin: const EdgeInsets.only(bottom: 16.0),
theme: const ExpandableThemeData( child: CustomCard(
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)), onTap: () {
tapBodyToCollapse: false, expController.toggle();
tapBodyToExpand: false, _animationController.isCompleted
tapHeaderToExpand: false, ? _animationController.reverse()
hasIcon: false, : _animationController.forward();
animationDuration: Duration(milliseconds: 450), },
), child: ExpandablePanel(
header: Padding( controller: expController,
padding: const EdgeInsets.only(bottom: 16.0), theme: const ExpandableThemeData(
child: CustomCard( inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
onTap: () { tapBodyToCollapse: false,
expController.toggle(); tapBodyToExpand: false,
_animationController.isCompleted tapHeaderToExpand: false,
? _animationController.reverse() hasIcon: false,
: _animationController.forward(); animationDuration: Duration(milliseconds: 450),
}, ),
child: Row( header: Row(
children: <Widget>[
SizedBox(
width: 40,
child: Image.memory(widget.icon, height: 40, width: 40),
),
const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.name.length > 9
? '${widget.name.substring(0, 9)}...'
: widget.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(format(widget.patchDate)),
],
),
),
const Spacer(),
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(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CustomMaterialButton( SizedBox(
label: widget.isUpdatableApp width: 40,
? I18nText('applicationItem.patchButton') child: Image.memory(widget.icon, height: 40, width: 40),
: I18nText('applicationItem.infoButton'), ),
onPressed: widget.onPressed, const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.name.length > 12
? '${widget.name.substring(0, 12)}...'
: widget.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(format(widget.patchDate)),
],
),
),
const Spacer(),
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),
),
),
const SizedBox(width: 8),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
CustomMaterialButton(
label: widget.isUpdatableApp
? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
),
],
), ),
], ],
), ),
], collapsed: const SizedBox(),
expanded: Padding(
padding: const EdgeInsets.only(top: 16.0, left: 4.0, right: 4.0, bottom: 4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
I18nText(
'applicationItem.changelogLabel',
child: const Text(
'',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
const SizedBox(height: 4),
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
],
),
), ),
), ),
), )
collapsed: const SizedBox(),
expanded: Padding(
padding: const EdgeInsets.all(16.0).copyWith(top: 0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
I18nText(
'applicationItem.changelogLabel',
child: const Text(
'',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
const SizedBox(height: 4),
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
],
),
),
); );
} }
} }