126 lines
4.6 KiB
Dart
126 lines
4.6 KiB
Dart
import 'package:fcs/widget/bottom_up_page_route.dart';
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
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(
|
|
centerTitle: true,
|
|
leading: new IconButton(
|
|
icon: new Icon(Icons.close),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
),
|
|
backgroundColor: primaryColor,
|
|
title: LocalText(
|
|
context,
|
|
'staff.list.title',
|
|
color: Colors.white,
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
onPressed: () {
|
|
Navigator.of(context).push(BottomUpPageRoute(StaffEditor()));
|
|
},
|
|
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),
|
|
shrinkWrap: true,
|
|
itemCount: employeeModel.employees.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
User user = employeeModel.employees[index];
|
|
return Stack(
|
|
children: <Widget>[
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.of(context)
|
|
.push(BottomUpPageRoute(StaffEditor(staff: user)));
|
|
},
|
|
child: Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: new Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
|
child: new Row(
|
|
children: <Widget>[
|
|
new Padding(
|
|
padding: new EdgeInsets.symmetric(
|
|
horizontal: 32.0 - dotSize / 2),
|
|
child: Icon(
|
|
MaterialCommunityIcons.worker,
|
|
color: primaryColor,
|
|
size: 40,
|
|
),
|
|
),
|
|
new Expanded(
|
|
child: new Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
new Text(
|
|
user.name,
|
|
style: new TextStyle(fontSize: 15.0),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(top: 8.0),
|
|
child: new Text(
|
|
user.phoneNumber,
|
|
style: new TextStyle(
|
|
fontSize: 15.0,
|
|
color: Colors.grey),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|