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 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill_internal.dart';
import 'package:frontend/utils/auth_utils.dart'; import 'package:frontend/utils/auth_utils.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -34,9 +35,15 @@ class _PlaceholdersModalState extends State<PlaceholdersModal> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
contentPadding: const EdgeInsets.fromLTRB(34, 30, 34, 30), contentPadding: const EdgeInsets.fromLTRB(34, 30, 34, 30),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
title: Text("Available Placeholders"), title: Text(
content: SizedBox( "Available Placeholders",
width: double.maxFinite, 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 // Set max height so ListView knows constraints
height: 300, height: 300,
child: ListView.builder( child: ListView.builder(
@ -73,7 +80,7 @@ class _PlaceholdersModalState extends State<PlaceholdersModal> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), 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), _buildFirstRow(widget.isDesktop),
SizedBox(height: 10), SizedBox(height: 10),
_buildSecondRow(widget.isDesktop), _buildSecondRow(widget.isDesktop),
SizedBox(height: 10), // SizedBox(height: 10),
_buildThirdRow(widget.isDesktop), _buildThirdRow(widget.isDesktop),
SizedBox(height: 10), SizedBox(height: 10),
_buildForthRow(widget.isDesktop), _buildForthRow(widget.isDesktop),

View File

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

View File

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