13dbb5fae5
- Added a new `role` attribute to the `Customer` model in `customer.dart` and updated the corresponding generated files. - Modified the `AuthViewModel` to set the user role based on the logged-in user's role. - Updated UI components in `TenderDetailActions` and `DesktopTendersPage` to conditionally render elements based on the user's role. - Refactored tests to validate the new role attribute in the `Customer` model.
88 lines
2.4 KiB
Dart
88 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:tm_app/core/theme/colors.dart';
|
|
import 'package:tm_app/core/utils/size_config.dart';
|
|
import 'package:tm_app/views/notification/strings/notification_strings.dart';
|
|
|
|
class PageSelectionDialog extends StatefulWidget {
|
|
final int totalPages;
|
|
final int currentPage;
|
|
|
|
const PageSelectionDialog({
|
|
required this.totalPages,
|
|
required this.currentPage,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
State<PageSelectionDialog> createState() => _PageSelectionDialogState();
|
|
}
|
|
|
|
class _PageSelectionDialogState extends State<PageSelectionDialog> {
|
|
late int selectedPage;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
selectedPage = widget.currentPage;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
backgroundColor: AppColors.backgroundColor,
|
|
insetPadding: EdgeInsets.symmetric(
|
|
horizontal: 16.0.w(),
|
|
vertical: 16.0.h(),
|
|
),
|
|
title: Text(
|
|
'${NotificationStrings.selectPage} (Current: ${widget.currentPage})',
|
|
style: TextStyle(
|
|
fontSize: 16.0.sp(),
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.grey80,
|
|
),
|
|
),
|
|
content: SizedBox(
|
|
width: 200,
|
|
height: 300,
|
|
child: ListView.builder(
|
|
itemCount: widget.totalPages,
|
|
itemBuilder: (context, index) {
|
|
final pageNumber = index + 1;
|
|
|
|
return ListTile(
|
|
contentPadding: EdgeInsets.zero,
|
|
leading: Radio<int>(
|
|
value: pageNumber,
|
|
groupValue: selectedPage,
|
|
activeColor: AppColors.mainBlue,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
selectedPage = value!;
|
|
});
|
|
context.pop(value);
|
|
},
|
|
),
|
|
title: Text(
|
|
'$pageNumber',
|
|
style: TextStyle(
|
|
fontSize: 16.0.sp(),
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.grey80,
|
|
),
|
|
),
|
|
onTap: () {
|
|
setState(() {
|
|
selectedPage = pageNumber;
|
|
});
|
|
context.pop(pageNumber);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|