feat(flutter): 应用克莱因蓝主题与印尼语适配
This commit is contained in:
1 parent
e1147cfcba
commit
10d448c8ba
31 files changed
+891
-521
No files matched your search
@@ -0,0 +1,41 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/formatting/localized_date_time.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'should_use_indonesian_material_date_and_time_when_locale_is_id',
|
||||
(tester) async {
|
||||
final value = DateTime(2026, 10, 17, 12, 30);
|
||||
late String formatted;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
locale: const Locale('id'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
formatted = formatLocalizedDateTime(context, value);
|
||||
final localizations = MaterialLocalizations.of(context);
|
||||
final expectedDate = localizations.formatCompactDate(
|
||||
value.toLocal(),
|
||||
);
|
||||
final expectedTime = localizations.formatTimeOfDay(
|
||||
TimeOfDay.fromDateTime(value.toLocal()),
|
||||
alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(
|
||||
context,
|
||||
),
|
||||
);
|
||||
expect(formatted, '$expectedDate $expectedTime');
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user