Testing Semantics

This commit is contained in:
venbaittech 2025-06-02 16:54:43 +05:30
parent ff74934520
commit b88973d43c
4 changed files with 118 additions and 94 deletions

View File

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill_internal.dart';
import 'package:frontend/utils/auth_utils.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http;
@ -34,9 +35,15 @@ class _PlaceholdersModalState extends State<PlaceholdersModal> {
backgroundColor: Colors.white,
contentPadding: const EdgeInsets.fromLTRB(34, 30, 34, 30),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
title: Text("Available Placeholders"),
content: SizedBox(
width: double.maxFinite,
title: Text(
"Available Placeholders",
style: GoogleFonts.poppins(fontSize: 15, fontWeight: FontWeight.w500),
),
content: Container(
width:
isDesktop
? MediaQuery.of(context).size.width * 0.3
: double.maxFinite,
// Set max height so ListView knows constraints
height: 300,
child: ListView.builder(
@ -73,7 +80,7 @@ class _PlaceholdersModalState extends State<PlaceholdersModal> {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text("Close"),
child: Text("Close", style: GoogleFonts.poppins(fontSize: 12)),
),
],
);

View File

@ -281,7 +281,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
_buildFirstRow(widget.isDesktop),
SizedBox(height: 10),
_buildSecondRow(widget.isDesktop),
SizedBox(height: 10),
// SizedBox(height: 10),
_buildThirdRow(widget.isDesktop),
SizedBox(height: 10),
_buildForthRow(widget.isDesktop),

View File

@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// import 'package:flutter/rendering.dart';
import 'package:flutter/rendering.dart';
import 'dart:html' as html;
import 'package:frontend/config/apiUrl.dart'; // 1 newly added
@ -29,7 +29,7 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// SemanticsBinding.instance.ensureSemantics(); // Safe here
SemanticsBinding.instance.ensureSemantics(); // Safe here
if (kIsWeb) {
final uri = Uri.parse(html.window.location.href);
if (uri.path == '/authredirection' &&

View File

@ -17,35 +17,41 @@ class OrganizationSetting extends StatefulWidget {
class OrganizationSettingState extends State<OrganizationSetting> {
@override
Widget build(BuildContext context) {
return ResponsiveBuilder(builder: (context, sizingInfo) {
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
return ResponsiveBuilder(
builder: (context, sizingInfo) {
bool isDesktop =
sizingInfo.deviceScreenType == DeviceScreenType.desktop;
return Scaffold(
backgroundColor: Color(0xFFf5f5f5),
// backgroundColor: Color(0xFFFCFCFC),
return Scaffold(
backgroundColor: Color(0xFFf5f5f5),
// backgroundColor: Color(0xFFFCFCFC),
// appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
appBar: CustomAppBar(isDesktop: isDesktop),
drawer: CustomDrawer(isDesktop: false),
body: Padding(
padding: isDesktop
? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width *
0.1, // 30% of screen width as horizontal padding
vertical: MediaQuery.of(context).size.height *
0, // 5% of screen height as vertical padding
)
: EdgeInsets.all(0),
child: Row(
children: [
// if (isDesktop) CustomDrawer(isDesktop: true),
Expanded(child: buildGroupListLayout(isDesktop))
],
// appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
appBar: CustomAppBar(isDesktop: isDesktop),
drawer: CustomDrawer(isDesktop: false),
body: Padding(
padding:
isDesktop
? EdgeInsets.symmetric(
horizontal:
MediaQuery.of(context).size.width *
0.1, // 30% of screen width as horizontal padding
vertical:
MediaQuery.of(context).size.height *
0, // 5% of screen height as vertical padding
)
: EdgeInsets.all(0),
child: Row(
children: [
// if (isDesktop) CustomDrawer(isDesktop: true),
Expanded(child: buildGroupListLayout(isDesktop)),
],
),
),
),
);
});
);
},
);
}
Widget buildGroupListLayout(bool isDesktop) {
@ -56,57 +62,63 @@ class OrganizationSettingState extends State<OrganizationSetting> {
'value': '/OrganizationSetup',
'icon': Icons.business,
'label': 'Organization Settings',
'description': 'Edit Logo and Email Configurations'
'description': 'Edit Logo and Email Configurations',
},
{
'value': '/group',
'icon': Icons.groups,
'label': 'Groups',
'description': 'Create and Edit Groups'
'description': 'Create and Edit Groups',
},
{
'value': '/PolicyList',
'icon': Icons.policy,
'label': 'Travel Policies',
'description': 'Create and Edit Travel Policy'
},
{
'value': '/department',
'icon': Icons.group_add_outlined,
'label': 'Departments',
'description': 'Create and Edit Department'
'description': 'Create and Edit Travel Policy',
},
{
'value': '/getPerdiem',
'icon': Icons.attach_money,
'label': 'Perdiem Amount',
'description': 'Create and Edit Perdiem Amount'
'description': 'Create and Edit Perdiem Amount',
},
{
'value': '/department',
'icon': Icons.group_add_outlined,
'label': 'Forex Template',
'description': 'Create and Edit Template',
},
{
'value': '/templateList',
'icon': Icons.email_outlined,
'label': 'Email Templates',
'description': ' Edit Email Template'
'description': ' Edit Email Template',
},
{
'value': '/department',
'icon': Icons.group_add_outlined,
'label': 'Departments',
'description': 'Create and Edit Department',
},
{
'value': '/costcenter',
'icon': Icons.account_balance_wallet,
'label': 'Cost Center',
'description': 'Create and Edit Cost Center'
'description': 'Create and Edit Cost Center',
},
{
'value': '/hotels',
'icon': Icons.add_business,
'label': 'Hotels',
'description': 'Create and Edit Hotels'
'description': 'Create and Edit Hotels',
},
{
'value': '/traveller',
'icon': Icons.travel_explore,
'label': 'Traveller',
'description': 'Create and Edit Traveller'
'description': 'Create and Edit Traveller',
},
];
// List<Widget> rows = [];
@ -225,55 +237,61 @@ class OrganizationSettingState extends State<OrganizationSetting> {
child: Wrap(
spacing: 16,
runSpacing: 16,
children: menuItems.map((item) {
return SizedBox(
width: isDesktop ? 325 : double.infinity,
child: Card(
color: Colors.white,
child: InkWell(
onTap: () {
final route = item['value'] as String;
context.go(route);
},
child: Padding(
padding: EdgeInsets.all(12),
child: Row(
children: [
Icon(item['icon'], size: 40, color: Color(0xFF114D8B)),
SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
item['label'],
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 4),
Text(
item['description'],
maxLines: 1,
overflow: TextOverflow.ellipsis,
softWrap: false,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
),
),
],
children:
menuItems.map((item) {
return SizedBox(
width: isDesktop ? 325 : double.infinity,
child: Card(
color: Colors.white,
child: InkWell(
onTap: () {
final route = item['value'] as String;
context.go(route);
},
child: Padding(
padding: EdgeInsets.all(12),
child: Row(
children: [
Icon(
item['icon'],
size: 40,
color: Color(0xFF114D8B),
),
),
],
SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
item['label'],
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 4),
Text(
item['description'],
maxLines: 1,
overflow: TextOverflow.ellipsis,
softWrap: false,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
),
),
],
),
),
],
),
),
),
),
),
);
}).toList(),
);
}).toList(),
),
),
),
@ -281,6 +299,5 @@ class OrganizationSettingState extends State<OrganizationSetting> {
],
),
);
}
}