You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.1 KiB
Dart
46 lines
2.1 KiB
Dart
|
1 year ago
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
||
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
||
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
||
|
|
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
|
||
|
|
import 'package:test_sa/models/service_request/service_request.dart';
|
||
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||
|
|
import 'package:test_sa/views/pages/user/requests/service_request_details.dart';
|
||
|
|
|
||
|
|
class PendingServiceRequestScreen extends StatelessWidget {
|
||
|
|
final PendingAssetServiceRequest pendingAssetServiceRequest;
|
||
|
|
|
||
|
|
PendingServiceRequestScreen(this.pendingAssetServiceRequest, {Key key}) : super(key: key);
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Scaffold(
|
||
|
|
appBar: DefaultAppBar(title: "Pending Requests (${pendingAssetServiceRequest.details.length})"),
|
||
|
|
body: ListView.separated(
|
||
|
|
itemCount: pendingAssetServiceRequest.details.length,
|
||
|
|
padding: EdgeInsets.all(16),
|
||
|
|
separatorBuilder: (cxt, index) => 12.height,
|
||
|
|
itemBuilder: (cxt, index) => Container(
|
||
|
|
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 8),
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: Colors.grey[200],
|
||
|
|
borderRadius: BorderRadius.circular(16),
|
||
|
|
),
|
||
|
|
child: Row(
|
||
|
|
children: [
|
||
|
|
Text(
|
||
|
|
pendingAssetServiceRequest.details[index].message.cleanupWhitespace?.capitalizeFirstOfEach ?? "",
|
||
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
||
|
|
).expanded,
|
||
|
|
Icon(Icons.arrow_forward_ios, size: 16)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
).onPress(() {
|
||
|
|
Navigator.of(context).push(MaterialPageRoute(
|
||
|
|
builder: (_) => ServiceRequestDetailsPage(
|
||
|
|
serviceRequest: ServiceRequest(id: pendingAssetServiceRequest.details[index].id.toString()),
|
||
|
|
)));
|
||
|
|
})));
|
||
|
|
}
|
||
|
|
}
|