Files
fcs/lib/pages/staff/staff_list.dart

111 lines
3.7 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/domain/entities/user.dart';
2020-10-11 02:17:23 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/staff/model/staff_model.dart';
2024-01-25 17:40:35 +06:30
import 'package:fcs/pages/widgets/local_app_bar.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
2020-09-18 04:04:21 +06:30
import 'package:flutter/cupertino.dart';
2020-09-13 21:49:39 +06:30
import 'package:flutter/material.dart';
2021-10-11 17:09:47 +06:30
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
2020-09-13 21:49:39 +06:30
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
2020-10-11 02:17:23 +06:30
2024-01-24 16:54:08 +06:30
import '../../pagination/paginator_listview.dart';
2020-09-13 21:49:39 +06:30
import 'staff_editor.dart';
import 'staff_info.dart';
2020-09-13 21:49:39 +06:30
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;
2024-01-24 16:54:08 +06:30
@override
void initState() {
context.read<StaffModel>().loadPaginationStaffs();
super.initState();
}
2020-09-13 21:49:39 +06:30
@override
Widget build(BuildContext context) {
StaffModel staffModel = Provider.of<StaffModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
2024-01-25 17:40:35 +06:30
appBar: LocalAppBar(labelKey: "staff.list.title"),
2024-01-24 16:54:08 +06:30
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).push(
CupertinoPageRoute(builder: (context) => StaffEditor()));
},
icon: Icon(Icons.add),
label: LocalText(context, "staff.new", color: Colors.white),
backgroundColor: primaryColor,
2020-09-13 21:49:39 +06:30
),
2024-01-24 16:54:08 +06:30
body: PaginatorListView<User>(
paginatorListener: staffModel.getStaffs!,
rowBuilder: (p) => _item(p),
color: primaryColor)),
2020-09-13 21:49:39 +06:30
);
}
Widget _item(User user) {
2020-10-19 05:13:49 +06:30
return InkWell(
onTap: () {
Navigator.of(context).push(
CupertinoPageRoute(builder: (context) => StaffInfo(staff: user)));
2020-10-19 05:13:49 +06:30
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
2020-10-19 05:13:49 +06:30
child: new Row(
children: <Widget>[
new Padding(
padding: new EdgeInsets.symmetric(horizontal: 15),
child: Icon(MaterialCommunityIcons.account_hard_hat,
color: primaryColor, size: 30),
2020-10-19 05:13:49 +06:30
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
2021-09-10 15:23:13 +06:30
user.name ?? "",
2020-10-19 05:13:49 +06:30
style: new TextStyle(fontSize: 15.0),
2020-09-13 21:49:39 +06:30
),
2020-10-19 05:13:49 +06:30
Padding(
padding: const EdgeInsets.only(top: 2),
child: new Text(
user.fcsID ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(top: 2),
2020-10-19 05:13:49 +06:30
child: new Text(
2021-09-10 15:23:13 +06:30
user.phoneNumber ?? "",
2020-10-19 05:13:49 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
2020-09-13 21:49:39 +06:30
),
2020-10-19 05:13:49 +06:30
],
),
2020-09-13 21:49:39 +06:30
),
2020-10-19 05:13:49 +06:30
],
2020-09-13 21:49:39 +06:30
),
2020-10-19 05:13:49 +06:30
),
2020-09-13 21:49:39 +06:30
),
2020-10-19 05:13:49 +06:30
],
),
2020-09-13 21:49:39 +06:30
);
}
}