update searchTextField

null_safety
小赖 4 years ago
parent 1d5c169e43
commit 4dbc95b492

@ -14,12 +14,13 @@ class _ExampleTextFiledState extends State<ExampleTextFiled> {
Widget build(BuildContext context) {
return ASScaffold(
title: '文本框 TextFiled',
appBarBottom: ASSearchTextField(
controller: _controller,
hintText: '搜索',
),
backgroundColor: kForegroundColor,
body: ListView(
children: [
ASSearchTextField(
controller: _controller,
hintText: '搜索',
),
ASSearchTextField.button(
hintText: '搜索',
onPressed: () {},

@ -37,6 +37,9 @@ class ASScaffold extends StatefulWidget {
/// `AppBar` appBar
final Widget appBar;
///
final Color backgroundColor;
ASScaffold({
Key key,
this.title,
@ -46,6 +49,7 @@ class ASScaffold extends StatefulWidget {
this.appBarBottom,
this.endDrawer,
this.appBar,
this.backgroundColor = kBackgroundColor,
}) : super(key: key);
@override
@ -57,7 +61,7 @@ class _ASScaffoldState extends State<ASScaffold> {
Widget build(BuildContext context) {
return Scaffold(
endDrawer: widget.endDrawer,
backgroundColor: kBackgroundColor,
backgroundColor: widget.backgroundColor,
bottomNavigationBar: widget.bottomNavigationBar,
appBar: widget.title == null &&
widget.appBar == null &&
@ -68,9 +72,6 @@ class _ASScaffoldState extends State<ASScaffold> {
brightness: Brightness.light,
backgroundColor: kForegroundColor,
elevation: 0,
toolbarHeight: widget.title == null && widget.appBar == null
? widget.appBarBottom.preferredSize.height + 2.0
: null,
leading: widget.leading ?? ASBackButton(),
centerTitle: true,
title: DefaultTextStyle(

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
///TextFiled
class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget {
class ASSearchTextField extends StatefulWidget {
ASSearchTextField({
Key key,
this.controller,
@ -54,9 +54,6 @@ class ASSearchTextField extends StatefulWidget implements PreferredSizeWidget {
@override
_ASSearchTextFieldState createState() => _ASSearchTextFieldState();
@override
Size get preferredSize => Size.fromHeight(42.w);
}
class _ASSearchTextFieldState extends State<ASSearchTextField> {

Loading…
Cancel
Save