Files
fcs/lib/pages/staff_list.dart

128 lines
4.7 KiB
Dart
Raw Normal View History

2020-06-02 14:56:51 +06:30
import 'package:fcs/widget/bottom_up_page_route.dart';
2020-06-01 14:24:45 +06:30
import 'package:fcs/widget/localization/app_translations.dart';
2020-05-29 16:14:17 +06:30
import 'package:flutter/material.dart';
2020-06-01 14:24:45 +06:30
import 'package:flutter_icons/flutter_icons.dart';
2020-05-29 16:14:17 +06:30
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:fcs/model/employee_model.dart';
import 'package:fcs/theme/theme.dart';
import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart';
import '../vo/user.dart';
import '../widget/local_text.dart';
import 'staff_editor.dart';
import 'util.dart';
class StaffList extends StatefulWidget {
@override
_StaffListState createState() => _StaffListState();
}
class _StaffListState extends State<StaffList> {
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
final double dotSize = 15.0;
bool _isLoading = false;
@override
Widget build(BuildContext context) {
var employeeModel = Provider.of<EmployeeModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
2020-06-01 14:24:45 +06:30
centerTitle: true,
leading: new IconButton(
icon: new Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
2020-05-29 16:14:17 +06:30
backgroundColor: primaryColor,
title: LocalText(
context,
2020-06-01 14:24:45 +06:30
'staff.list.title',
2020-05-29 16:14:17 +06:30
color: Colors.white,
2020-06-01 14:24:45 +06:30
fontSize: 20,
2020-05-29 16:14:17 +06:30
),
),
2020-06-01 14:24:45 +06:30
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
2020-06-02 14:56:51 +06:30
Navigator.of(context).push(BottomUpPageRoute(StaffEditor()));
2020-06-01 14:24:45 +06:30
},
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("staff.new")),
backgroundColor: primaryColor,
),
body: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
2020-05-29 16:14:17 +06:30
shrinkWrap: true,
itemCount: employeeModel.employees.length,
itemBuilder: (BuildContext context, int index) {
2020-06-01 14:24:45 +06:30
User user = employeeModel.employees[index];
return Stack(
children: <Widget>[
InkWell(
2020-05-29 16:14:17 +06:30
onTap: () {
2020-06-02 14:56:51 +06:30
Navigator.of(context)
.push(BottomUpPageRoute(StaffEditor(staff: user)));
2020-05-29 16:14:17 +06:30
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
2020-06-01 14:24:45 +06:30
padding: const EdgeInsets.symmetric(vertical: 10.0),
2020-05-29 16:14:17 +06:30
child: new Row(
children: <Widget>[
new Padding(
padding: new EdgeInsets.symmetric(
horizontal: 32.0 - dotSize / 2),
2020-06-01 14:24:45 +06:30
child: Icon(
2020-06-02 00:00:05 +06:30
MaterialCommunityIcons.worker,
2020-05-29 16:14:17 +06:30
color: primaryColor,
2020-06-01 14:24:45 +06:30
size: 40,
2020-05-29 16:14:17 +06:30
),
),
new Expanded(
child: new Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
new Text(
2020-06-01 14:24:45 +06:30
user.name,
2020-05-29 16:14:17 +06:30
style: new TextStyle(
fontSize: 15.0,
2020-06-01 14:24:45 +06:30
color: primaryColor),
2020-05-29 16:14:17 +06:30
),
2020-06-01 14:24:45 +06:30
Padding(
padding:
const EdgeInsets.only(top: 8.0),
child: new Text(
user.phoneNumber,
style: new TextStyle(
fontSize: 15.0,
color: Colors.grey),
),
2020-05-29 16:14:17 +06:30
),
],
),
),
],
),
),
),
],
),
),
2020-06-01 14:24:45 +06:30
],
2020-05-29 16:14:17 +06:30
);
}),
),
);
}
}