mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-30 06:48:49 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
import 'package:hash_wallet/new-ui/widgets/dropdown_row.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AnimatedDropdown extends StatefulWidget {
|
|
const AnimatedDropdown({super.key, required this.content, required this.dropdownText});
|
|
|
|
final Widget content;
|
|
final String dropdownText;
|
|
|
|
@override
|
|
State<AnimatedDropdown> createState() => _AnimatedDropdownState();
|
|
}
|
|
|
|
class _AnimatedDropdownState extends State<AnimatedDropdown> {
|
|
bool _expanded = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ClipRSuperellipse(
|
|
borderRadius: BorderRadius.circular(20),
|
|
child: Container(
|
|
decoration: ShapeDecoration(
|
|
shape: RoundedSuperellipseBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
DropdownRow(
|
|
expanded: _expanded,
|
|
text: widget.dropdownText,
|
|
onTap: () {
|
|
setState(() {
|
|
_expanded = !_expanded;
|
|
});
|
|
},
|
|
),
|
|
AnimatedOpacity(
|
|
duration: Duration(milliseconds: 150),
|
|
opacity: _expanded ? 1 : 0,
|
|
child: Divider(
|
|
height: 1,
|
|
thickness: 1,
|
|
)),
|
|
AnimatedCrossFade(
|
|
firstChild: Container(height: 0),
|
|
secondChild: widget.content,
|
|
crossFadeState: _expanded ? CrossFadeState.showSecond : CrossFadeState.showFirst,
|
|
duration: const Duration(milliseconds: 300),
|
|
sizeCurve: Curves.easeOutCubic,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|