123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import 'package:flutter/material.dart';
- import 'package:lszlgl/config/pics.dart';
- export 'package:lszlgl/config/pics.dart';
- export 'package:lszlgl/router/my_navigator.dart';
- export 'package:lszlgl/router/my_router.dart';
- abstract class BaseState<T extends StatefulWidget> extends State<T> {
- /// 隐藏软键盘
- void hideKeyboard() {
- FocusScopeNode currentFocus = FocusScope.of(context);
- if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
- FocusManager.instance.primaryFocus?.unfocus();
- }
- }
- AppBar myAppBar({
- String title = '',
- String? titleIcon,
- bool autoLeading = true,
- PreferredSizeWidget? bottom,
- }) {
- return AppBar(
- title: Text(title),
- bottom: bottom,
- automaticallyImplyLeading: autoLeading,
- );
- }
- /// 带背景图的Scaffold
- Widget myScaffold({required Widget child}) {
- return Scaffold(
- body: Stack(
- children: [
- SizedBox(width: double.infinity, child: Image.asset(imgHomeTopBg)),
- child,
- ],
- ),
- );
- }
- }
|