|
@@ -1,270 +0,0 @@
|
|
|
-import 'package:flustars/flustars.dart';
|
|
|
-import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter/services.dart';
|
|
|
-import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
-import 'package:get/get.dart';
|
|
|
-import 'package:ftrecruiter/comm/constants/color_constants.dart';
|
|
|
-import 'package:ftrecruiter/comm/constants/sp_constant.dart';
|
|
|
-import 'package:ftrecruiter/comm/utils/log_utils.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/my_click_item.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/my_input_field.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/my_button.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/common_widget.dart';
|
|
|
-import 'package:ftrecruiter/comm/utils/dark_theme_util.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/my_load_image.dart';
|
|
|
-import 'package:ftrecruiter/comm/widget/my_text_view.dart';
|
|
|
-import 'package:ftrecruiter/modules/zdemo/demo_load_page.dart';
|
|
|
-import 'package:ftrecruiter/modules/zdemo/demo_scroll1.dart';
|
|
|
-import 'package:ftrecruiter/modules/zdemo/theme_page.dart';
|
|
|
-
|
|
|
-import 'demo_controller.dart';
|
|
|
-
|
|
|
-class DemoPage extends GetView<DemoController> {
|
|
|
- @override
|
|
|
- Widget build(BuildContext context) {
|
|
|
- return Scaffold(
|
|
|
- backgroundColor: DarkThemeUtil.multiColors(Colors.white),
|
|
|
- appBar: CommonWidget.appBar(context, "Demo"),
|
|
|
- body: Container(
|
|
|
- width: double.infinity,
|
|
|
- height: double.infinity,
|
|
|
- child: ListView(
|
|
|
- shrinkWrap: true,
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 30.0),
|
|
|
- children: [
|
|
|
- const SizedBox(height: 20.0),
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- 'welcome'.tr,
|
|
|
- textAlign: TextAlign.left,
|
|
|
- softWrap: true,
|
|
|
- style: const TextStyle(fontSize: 20, color: Colors.black, decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- Text(
|
|
|
- 'title'.tr,
|
|
|
- textAlign: TextAlign.center,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 22,
|
|
|
- decoration: TextDecoration.none,
|
|
|
- color: Theme.of(context).textTheme.subtitle1!.color,
|
|
|
- ),
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- Row(
|
|
|
- //宽度不想充满屏幕,可以使用row包裹
|
|
|
- children: [
|
|
|
- ElevatedButton(
|
|
|
- child: const Text("Go To Demo Load Page"),
|
|
|
- onPressed: () {
|
|
|
- Get.to(() => DemoLoadPage());
|
|
|
- }),
|
|
|
- const SizedBox(width: 15.0),
|
|
|
- ElevatedButton(
|
|
|
- child: const Text("Go To Scroll Page"),
|
|
|
- onPressed: () {
|
|
|
- Get.to(() => DemoScroll1Page());
|
|
|
- })
|
|
|
- ],
|
|
|
- ),
|
|
|
- CommonWidget.rowHeight(height: 10),
|
|
|
- TextButton(
|
|
|
- style: ButtonStyle(
|
|
|
- minimumSize: MaterialStateProperty.all<Size>(Size(200, 45)), // 设置最小宽度和高度
|
|
|
- backgroundColor: MaterialStateProperty.all<Color>(Colors.redAccent),
|
|
|
- ),
|
|
|
- onPressed: () {
|
|
|
- //调用接口
|
|
|
- controller.getServerTime();
|
|
|
- },
|
|
|
- child: const Text(
|
|
|
- '网络请求获取数据',
|
|
|
- style: TextStyle(fontSize: 16, color: Colors.white),
|
|
|
- ),
|
|
|
- // color: Colors.redAccent,
|
|
|
- // textColor: Colors.white,
|
|
|
- // disabledColor: Colors.black,
|
|
|
- // disabledTextColor: Colors.black38,
|
|
|
- // splashColor: Colors.white, //水波纹的颜色
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- controller.obx(
|
|
|
- (state) => Text(
|
|
|
- "time:${state?.timestamps}",
|
|
|
- textAlign: TextAlign.center,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 22,
|
|
|
- color: Theme.of(context).textTheme.subtitle1!.color,
|
|
|
- ),
|
|
|
- ),
|
|
|
- onError: (err) => Text("onEmpty" + err.toString()),
|
|
|
- onEmpty: const Text("onEmpty"),
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- DarkThemeUtil.multiImageColorFit("assets/images/splash_center_blue_logo.webp", 144, 112, darkColor: Colors.white),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyInputField(
|
|
|
- controller: controller.registerEmailController,
|
|
|
- keyboardType: TextInputType.text,
|
|
|
- labelText: '',
|
|
|
- placeholder: 'Enter Email Address',
|
|
|
- validator: (value) {
|
|
|
- if (value?.isEmpty ?? true) {
|
|
|
- return 'Email is required.';
|
|
|
- }
|
|
|
- return null;
|
|
|
- },
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyClickItem(
|
|
|
- title: '测试SP-存和取',
|
|
|
- drawablePadding: 0,
|
|
|
- onTap: () {
|
|
|
- SpUtil.putString("username", "Sky24n");
|
|
|
- SpUtil.putString(SPConstant.SP_KEY_TOKEN,
|
|
|
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC95eWpvYnMtYXBpLWRldi5ndWFiZWFuLmNvbVwvaW5kZXgucGhwXC9hcGlcL2VtcGxveWVlXC9hdXRoXC9sb2dpbiIsImlhdCI6MTY1MDQyMDQxMiwiZXhwIjoxNjg2NDIwNDEyLCJuYmYiOjE2NTA0MjA0MTIsImp0aSI6IjlWNmgyS29qQ1BJZ1NSa2MiLCJzdWIiOjI4OTQ3LCJwcnYiOiI4NjY1YWU5Nzc1Y2YyNmY2YjhlNDk2Zjg2ZmE1MzZkNjhkZDcxODE4In0.X2kXCz2HcBvVxBVTB-JQTou56pCh_t221WTZdVHpM5M");
|
|
|
- String? userName = SpUtil.getString("username");
|
|
|
- if (!TextUtil.isEmpty(userName)) {
|
|
|
- SmartDialog.compatible.showToast('username:$userName');
|
|
|
- }
|
|
|
- },
|
|
|
- backgroundColor: ColorConstants.dividerColor,
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- TextButton(
|
|
|
- child: const Text(
|
|
|
- '测试吐司与Log',
|
|
|
- style: TextStyle(fontSize: 16, color: Colors.white),
|
|
|
- ),
|
|
|
- onPressed: () {
|
|
|
- SmartDialog.compatible.showToast('test toast');
|
|
|
- Log.d("我是Lop数据 -ddd");
|
|
|
- Log.e("我是Lop数据 -eee");
|
|
|
- SmartDialog.compatible.showLoading();
|
|
|
- },
|
|
|
-
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all<Color>(Colors.redAccent), // 设置背景颜色为蓝色
|
|
|
- ),
|
|
|
- // color: Colors.redAccent,
|
|
|
- // textColor: Colors.white,
|
|
|
- // disabledColor: Colors.black,
|
|
|
- // disabledTextColor: Colors.black38,
|
|
|
- // splashColor: Colors.white, //水波纹的颜色
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- ElevatedButton(
|
|
|
- // color: Colors.blue,
|
|
|
- // highlightColor: Colors.blue[700],
|
|
|
- // colorBrightness: Brightness.dark,
|
|
|
- // splashColor: Colors.grey,
|
|
|
- child: const Text("测试弹窗"),
|
|
|
- // shape: RoundedRectangleBorder(
|
|
|
- // borderRadius: BorderRadius.circular(20.0)),
|
|
|
- onPressed: () async {
|
|
|
- SmartDialog.compatible.showLoading(clickBgDismissTemp: true);
|
|
|
- SmartDialog.compatible.dismiss();
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all<Color>(Colors.blue), // 设置背景色为蓝色
|
|
|
- elevation: MaterialStateProperty.all<double>(10), // 设置阴影的程度
|
|
|
- textStyle: MaterialStateProperty.all<TextStyle>(TextStyle(fontSize: 20)), // 设置文本的样式
|
|
|
- padding:
|
|
|
- MaterialStateProperty.all<EdgeInsets>(EdgeInsets.symmetric(horizontal: 16, vertical: 8)), // 设置内边距
|
|
|
- ),
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyButton(
|
|
|
- text: "切换主题-黑暗模式",
|
|
|
- backgroundColor: Colors.lightBlue,
|
|
|
- radius: 5,
|
|
|
- onPressed: () {
|
|
|
- SmartDialog.compatible.showToast("切换主题");
|
|
|
- Get.to(() => const ThemePage());
|
|
|
- },
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyTextView("自定义textview自定义textview自定义textview自定义textview自定义textview",
|
|
|
- backgroundColor: Colors.red,
|
|
|
- textColor: Colors.white,
|
|
|
- padding: 10,
|
|
|
- cornerRadius: 10,
|
|
|
- borderColor: Colors.yellow,
|
|
|
- borderWidth: 1,
|
|
|
- marginTop: 5,
|
|
|
- singleLine: false, onClick: () {
|
|
|
- Log.d("点击事件");
|
|
|
- }),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyButton(
|
|
|
- text: "自定义圆角按钮",
|
|
|
- backgroundColor: DarkThemeUtil.multiColors(ColorConstants.dividerColor, darkColor: Colors.deepOrange),
|
|
|
- radius: 20,
|
|
|
- onPressed: () {},
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyTextView("简单的TextView显示", textColor: Colors.black, singleLine: false),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyTextView(
|
|
|
- "Test Font Family Font Size",
|
|
|
- fontSize: 18,
|
|
|
- textColor: Colors.black,
|
|
|
- singleLine: false,
|
|
|
- isFonTimeNew: true,
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- MyLoadImage(
|
|
|
- 'https://i04piccdn.sogoucdn.com/a35bde4b5756167a',
|
|
|
- width: 340,
|
|
|
- height: 191,
|
|
|
- cornerRadius: 15,
|
|
|
- borderColor: Colors.red,
|
|
|
- borderWidth: 1,
|
|
|
- ),
|
|
|
- const SizedBox(height: 10.0),
|
|
|
- Row(
|
|
|
- //如果不包裹容器,默认宽度会充满全屏的
|
|
|
- children: [
|
|
|
- MyLoadImage(
|
|
|
- 'https://i04piccdn.sogoucdn.com/a35bde4b5756167a',
|
|
|
- width: 100,
|
|
|
- height: 100,
|
|
|
- isCircle: true,
|
|
|
- onClick: () {
|
|
|
-
|
|
|
- SmartDialog.compatible.show(
|
|
|
- widget: Container(
|
|
|
- height: 80,
|
|
|
- width: 180,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.black,
|
|
|
- borderRadius: BorderRadius.circular(10),
|
|
|
- ),
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- 'easy custom dialog',
|
|
|
- style: TextStyle(color: Colors.white),
|
|
|
- ),
|
|
|
- ));
|
|
|
-
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(height: 10),
|
|
|
- ElevatedButton(
|
|
|
- child: const Text("Test Future"),
|
|
|
- onPressed: () {
|
|
|
- controller.testFuture();
|
|
|
- }),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
-}
|