APY integrated without testing...
This commit is contained in:
@@ -27,9 +27,9 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
String? _selectedScheme;
|
||||
|
||||
List<String> _getSchemes(AppLocalizations l10n) => [
|
||||
l10n.pmjjbyFull,
|
||||
l10n.pmsbyFull,
|
||||
];
|
||||
l10n.pmjjbyFull,
|
||||
l10n.pmsbyFull,
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -76,7 +76,8 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
final String schemeCode = (_selectedScheme == l10n.pmjjbyFull) ? '02' : '01';
|
||||
final String schemeCode =
|
||||
(_selectedScheme == l10n.pmjjbyFull) ? '02' : '01';
|
||||
|
||||
// Show loading
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -103,7 +104,9 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
Map<String, dynamic>? data;
|
||||
if (response is Map<String, dynamic>) {
|
||||
data = response;
|
||||
} else if (response is List && response.isNotEmpty && response[0] is Map<String, dynamic>) {
|
||||
} else if (response is List &&
|
||||
response.isNotEmpty &&
|
||||
response[0] is Map<String, dynamic>) {
|
||||
data = response[0] as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
@@ -169,15 +172,15 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final schemes = _getSchemes(l10n);
|
||||
|
||||
|
||||
// Ensure _selectedScheme is valid if it was set in a different language
|
||||
if (_selectedScheme != null && !schemes.contains(_selectedScheme)) {
|
||||
// Try to find the corresponding scheme in the new language
|
||||
// This is a bit tricky, but since we only have two:
|
||||
// If it doesn't match, it might be from the other language.
|
||||
// For simplicity, we can just reset it or try to guess.
|
||||
// Better to use non-localized values for the state, but let's just reset for now if it doesn't match
|
||||
_selectedScheme = null;
|
||||
// Try to find the corresponding scheme in the new language
|
||||
// This is a bit tricky, but since we only have two:
|
||||
// If it doesn't match, it might be from the other language.
|
||||
// For simplicity, we can just reset it or try to guess.
|
||||
// Better to use non-localized values for the state, but let's just reset for now if it doesn't match
|
||||
_selectedScheme = null;
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
@@ -243,23 +246,23 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.selectScheme,
|
||||
border: const OutlineInputBorder(),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
vertical: 12, horizontal: 12),
|
||||
),
|
||||
selectedItemBuilder: (BuildContext context) {
|
||||
return schemes.map((String scheme) {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
scheme,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
softWrap: true,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
selectedItemBuilder: (BuildContext context) {
|
||||
return schemes.map((String scheme) {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
scheme,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
softWrap: true,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
items: schemes.map((String scheme) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: scheme,
|
||||
@@ -268,7 +271,6 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
child: Text(
|
||||
scheme,
|
||||
style: const TextStyle(fontSize: 15),
|
||||
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
@@ -336,4 +338,3 @@ class _PMMainScreenState extends State<PMMainScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user