82 lines
2.1 KiB
Dart
82 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:novyronst/root/lib_export.dart';
|
|
import 'package:novyronst/tools/widgets/novy_com_widget.dart';
|
|
|
|
class NyProgressWidget extends StatelessWidget {
|
|
const NyProgressWidget({super.key,
|
|
this.progress = 0.4,
|
|
this.width,
|
|
});
|
|
|
|
final double progress;
|
|
final double? width;
|
|
static final double _width = AppScreen.screenWidth - 50;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
SizedBox(
|
|
height: 14,
|
|
width: width ?? _width
|
|
),
|
|
Positioned(
|
|
left: 0, right: 0, top: 4.5,
|
|
child: Container(
|
|
height: 5,
|
|
padding: EdgeInsets.symmetric(horizontal: 2),
|
|
decoration: BoxDecoration(
|
|
color: Colors.black,
|
|
borderRadius: BorderRadius.circular(2.5),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: (progress * 100).toInt(),
|
|
child: _line(),
|
|
),
|
|
Expanded(
|
|
flex: 100 - (progress * 100).toInt(),
|
|
child: _line(isActive: false),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 0, left: (width ?? _width - 50) * progress,
|
|
child: _pTag(),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
Container _line({bool isActive = true}) {
|
|
return Container(
|
|
height: 2,
|
|
decoration: BoxDecoration(
|
|
color: isActive ? ConstColor.btGreen : ConstColor.btGreen.withAlpha(127),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _pTag() {
|
|
return Container(
|
|
height: 14,
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
decoration: BoxDecoration(
|
|
color: ConstColor.btGreen,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(4),
|
|
bottomLeft: Radius.circular(4),
|
|
topRight: Radius.circular(16),
|
|
bottomRight: Radius.circular(4),
|
|
)
|
|
),
|
|
child: NovyText('${(progress * 100).toInt()}%',
|
|
fontSize: 10,
|
|
color: Colors.black,
|
|
),
|
|
);
|
|
}
|
|
} |