Skip to content

Commit

Permalink
Add carat
Browse files Browse the repository at this point in the history
  • Loading branch information
apesic committed Sep 19, 2020
1 parent cdf1179 commit eae1f1f
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions lib/stack_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,66 @@ class StackItemWidget extends StatelessWidget {
}
});
},
child: Text('$item',
textAlign: TextAlign.right,
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 24, color: color),
)),
child: Column(
children: [
IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text('$item',
textAlign: TextAlign.right,
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 36, color: color),
)),
if (item is EditableItem)
const Carat()
else
const Padding(padding: EdgeInsets.only(right: 2)),
],
),
),
],
),
);
}

class Carat extends StatefulWidget {
@override
const Carat({Key key}) : super(key: key);

@override
_CaratState createState() => _CaratState();
}

class _CaratState extends State<Carat> with SingleTickerProviderStateMixin {
AnimationController _controller;
final duration = const Duration(milliseconds: 500);

@override
void initState() {
_controller = AnimationController(
duration: duration,
reverseDuration: duration,
vsync: this,
)..repeat(reverse: true);
super.initState();
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) => FadeTransition(
opacity: _controller,
child: const VerticalDivider(
indent: 2,
endIndent: 2,
thickness: 2,
width: 2,
color: Colors.white,
),
);
}

0 comments on commit eae1f1f

Please sign in to comment.