fix on history design
parent
ee6288e26a
commit
c8b44936f8
@ -0,0 +1,93 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class PriorityBar extends StatefulWidget {
|
||||||
|
final Function onTap;
|
||||||
|
|
||||||
|
const PriorityBar({Key key, this.onTap}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PriorityBarState createState() => _PriorityBarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PriorityBarState extends State<PriorityBar> {
|
||||||
|
int _activePriority = 0;
|
||||||
|
int index = -1;
|
||||||
|
List<String> _priorities = [
|
||||||
|
"Family",
|
||||||
|
"Surgical/Sports",
|
||||||
|
"Medical",
|
||||||
|
];
|
||||||
|
List<String> _prioritiesAr = [
|
||||||
|
"أسرة",
|
||||||
|
"جراحي / رياضي",
|
||||||
|
"طبي",
|
||||||
|
];
|
||||||
|
|
||||||
|
BoxDecoration containerBorderDecoration(
|
||||||
|
Color containerColor, Color borderColor) {
|
||||||
|
return BoxDecoration();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
height: screenSize.height * 0.080,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: _priorities.map((
|
||||||
|
item,
|
||||||
|
) {
|
||||||
|
bool _isActive = _priorities[_activePriority] == item ? true : false;
|
||||||
|
if (index < 2) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: screenSize.height * 0.070,
|
||||||
|
decoration: containerBorderDecoration(
|
||||||
|
_isActive ? HexColor("#B8382B") : Colors.white,
|
||||||
|
_isActive ? HexColor("#B8382B") : Colors.white),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
(projectViewModel.isArabic)
|
||||||
|
? _prioritiesAr[index]
|
||||||
|
: item,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: Colors.black, //Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if(_isActive)
|
||||||
|
Container(width: 120,height: 4,color: AppGlobal.appPrimaryColor,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
widget.onTap(_priorities.indexOf(item));
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_activePriority = _priorities.indexOf(item);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue