Skip to content

Commit

Permalink
fixup! Add ExpansionTileWithArrow class
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Aug 2, 2023
1 parent 66d7a60 commit 6b77d96
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions mobile/lib/common/expansion_tile_with_arrow.dart
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
import 'package:flutter/material.dart';

class ExpansionTileWithArrow extends StatefulWidget {
const ExpansionTileWithArrow(
{super.key,
required this.leading,
required this.title,
required this.subtitle,
required this.trailing,
required this.children});
const ExpansionTileWithArrow({
super.key,
required this.leading,
required this.title,
required this.subtitle,
required this.trailing,
required this.children,
this.expandedCrossAxisAlignment,
this.expandedAlignment,
});

final Widget leading;
final Widget title;
final Widget subtitle;
final Widget trailing;
final List<Widget> children;
final CrossAxisAlignment? expandedCrossAxisAlignment;
final Alignment? expandedAlignment;

@override
State<ExpansionTileWithArrow> createState() => _ExpansionTileWithArrowState();
}

class _ExpansionTileWithArrowState extends State<ExpansionTileWithArrow> with SingleTickerProviderStateMixin {
static final Animatable<double> _iconCurve = Tween<double>(begin: 0.0, end: 0.5).chain(CurveTween(curve: Curves.easeIn));
class _ExpansionTileWithArrowState extends State<ExpansionTileWithArrow>
with SingleTickerProviderStateMixin {
static final Animatable<double> _iconCurve =
Tween<double>(begin: 0.0, end: 0.5).chain(CurveTween(curve: Curves.easeIn));
late Animation<double> _iconTurns;
late AnimationController _animationController;

@override
void initState() {
_animationController = AnimationController(duration: const Duration(milliseconds: 200), vsync: this);
_animationController =
AnimationController(duration: const Duration(milliseconds: 200), vsync: this);
_iconTurns = _animationController.drive(_iconCurve);
super.initState();
}
Expand All @@ -37,6 +45,8 @@ class _ExpansionTileWithArrowState extends State<ExpansionTileWithArrow> with Si
leading: widget.leading,
title: widget.title,
subtitle: widget.subtitle,
expandedCrossAxisAlignment: widget.expandedCrossAxisAlignment,
expandedAlignment: widget.expandedAlignment,
trailing: FittedBox(
child: Row(
children: [
Expand Down

0 comments on commit 6b77d96

Please sign in to comment.