30 lines
742 B
Dart
30 lines
742 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import 'home_controller.dart';
|
|
|
|
class HomeView extends GetView<HomeController> {
|
|
const HomeView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('HomeView'),
|
|
centerTitle: true,
|
|
),
|
|
body: Center(
|
|
child: ElevatedButton(
|
|
onPressed: () {
|
|
if (Get.locale?.languageCode == 'zh') {
|
|
Get.updateLocale(const Locale('en', 'US'));
|
|
} else {
|
|
Get.updateLocale(const Locale('zh', 'CN'));
|
|
}
|
|
},
|
|
child: Text('切换成英语${'路由'.tr}')),
|
|
),
|
|
);
|
|
}
|
|
}
|