Browse Source

neon: Allow completely hiding linear progress indicator

pull/346/head
jld3103 2 years ago
parent
commit
a5a90c6892
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 28
      packages/neon/neon/lib/src/widgets/linear_progress_indicator.dart

28
packages/neon/neon/lib/src/widgets/linear_progress_indicator.dart

@ -3,6 +3,7 @@ part of '../../neon.dart';
class NeonLinearProgressIndicator extends StatelessWidget { class NeonLinearProgressIndicator extends StatelessWidget {
const NeonLinearProgressIndicator({ const NeonLinearProgressIndicator({
this.visible = true, this.visible = true,
this.alwaysThere = true,
this.margin = const EdgeInsets.symmetric(horizontal: 10), this.margin = const EdgeInsets.symmetric(horizontal: 10),
this.color, this.color,
this.backgroundColor = Colors.transparent, this.backgroundColor = Colors.transparent,
@ -10,21 +11,24 @@ class NeonLinearProgressIndicator extends StatelessWidget {
}); });
final bool visible; final bool visible;
final bool alwaysThere;
final EdgeInsets? margin; final EdgeInsets? margin;
final Color? color; final Color? color;
final Color? backgroundColor; final Color? backgroundColor;
@override @override
Widget build(final BuildContext context) => Container( Widget build(final BuildContext context) => !alwaysThere && !visible
margin: margin, ? Container()
child: SizedBox( : Container(
height: 3, margin: margin,
child: visible child: SizedBox(
? LinearProgressIndicator( height: 3,
color: color, child: visible
backgroundColor: backgroundColor, ? LinearProgressIndicator(
) color: color,
: null, backgroundColor: backgroundColor,
), )
); : null,
),
);
} }

Loading…
Cancel
Save