feat: dropdown for changelogs.

This commit is contained in:
Aunali321 2022-09-16 00:49:11 +05:30
parent 9f58757caf
commit 8300cc4071
3 changed files with 60 additions and 11 deletions

View File

@ -69,7 +69,8 @@
}, },
"patchesSelectorView": { "patchesSelectorView": {
"searchBarHint": "Search patches", "searchBarHint": "Search patches",
"doneButton": "Done" "doneButton": "Done",
"noPatchesFound": "No patches found for the selected app."
}, },
"patchItem": { "patchItem": {
"unsupportedWarningButton": "Unsupported version", "unsupportedWarningButton": "Unsupported version",

View File

@ -55,9 +55,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
const SizedBox(height: 12), const SizedBox(height: 12),
Expanded( Expanded(
child: model.patches.isEmpty child: model.patches.isEmpty
? Center( ? Padding(
child: CircularProgressIndicator( padding: const EdgeInsets.all(8.0),
color: Theme.of(context).colorScheme.primary, child: Center(
child: I18nText(
'patchesSelectorView.noPatchesFound',
child: Text(
'',
style: Theme.of(context).textTheme.bodyMedium,
),
),
), ),
) )
: ListView( : ListView(

View File

@ -6,7 +6,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
class ApplicationItem extends StatelessWidget { class ApplicationItem extends StatefulWidget {
final Uint8List icon; final Uint8List icon;
final String name; final String name;
final DateTime patchDate; final DateTime patchDate;
@ -24,10 +24,39 @@ class ApplicationItem extends StatelessWidget {
required this.onPressed, required this.onPressed,
}) : super(key: key); }) : super(key: key);
@override
State<ApplicationItem> createState() => _ApplicationItemState();
}
class _ApplicationItemState extends State<ApplicationItem>
with TickerProviderStateMixin {
late AnimationController _animationController;
@override
initState() {
super.initState();
_animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
);
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ExpandableController expController = ExpandableController();
return ExpandablePanel( return ExpandablePanel(
controller: expController,
theme: const ExpandableThemeData( theme: const ExpandableThemeData(
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
tapBodyToCollapse: false,
tapBodyToExpand: false,
tapHeaderToExpand: false,
hasIcon: false, hasIcon: false,
animationDuration: Duration(milliseconds: 450), animationDuration: Duration(milliseconds: 450),
), ),
@ -36,32 +65,44 @@ class ApplicationItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
width: 60, width: 60,
child: Image.memory(icon, height: 39, width: 39), child: Image.memory(widget.icon, height: 39, width: 39),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
name, widget.name,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
Text(format(patchDate)), Text(format(widget.patchDate)),
], ],
), ),
const Spacer(), const Spacer(),
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),
),
),
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CustomMaterialButton( CustomMaterialButton(
label: isUpdatableApp label: widget.isUpdatableApp
? I18nText('applicationItem.patchButton') ? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'), : I18nText('applicationItem.infoButton'),
onPressed: onPressed, onPressed: widget.onPressed,
), ),
], ],
), ),
@ -82,7 +123,7 @@ class ApplicationItem extends StatelessWidget {
), ),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text('\u2022 ${changelog.join('\n\u2022 ')}'), Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
], ],
), ),
), ),