1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:taskservice/Common/JXColors.dart';
- class MyScaffold extends StatelessWidget {
- final Widget body;
- final String title;
- MyScaffold({@required this.title, @required this.body});
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- centerTitle: true,
- title: Text(title),
- backgroundColor: JXColors.k101E40,
- ),
- body: SafeArea(
- child: body,
- ),
- );
- }
- }
- class SearchBar extends StatefulWidget {
- final Function(String value) onTextChanged;
- final String hint;
- final FocusNode focusNode;
- final Function() onBtnClear;
- final TextEditingController searchController;
- SearchBar({this.onTextChanged, this.hint, this.focusNode, this.onBtnClear, this.searchController});
- @override
- _SearchBarState createState() => _SearchBarState();
- }
- class _SearchBarState extends State<SearchBar> {
- @override
- Widget build(BuildContext context) {
- return Container(
- color: JXColors.kF0F0F0,
- padding: EdgeInsets.fromLTRB(12.0, 8, 12.0, 8),
- child: Container(
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: JXColors.kE6E6E6,
- borderRadius: BorderRadius.circular(12.0),
- border: Border.all(color: JXColors.kE6E6E6, width: 1),
- ),
- height: 44.0,
- child: Row(children: <Widget>[
- SizedBox(
- width: 12,
- ),
- Icon(
- Icons.search,
- size: 24.0,
- ),
- SizedBox(
- width: 6,
- ),
- Expanded(
- child: TextField(
- controller: widget.searchController,
- maxLines: 1,
- focusNode: widget.focusNode,
- obscureText: false,
- cursorColor: JXColors.k1F2529,
- decoration: InputDecoration(
- border: InputBorder.none,
- hintText: '快速筛选',
- labelStyle: TextStyle(
- color: JXColors.k2E3032,
- fontSize: 24.0,
- ),
- ),
- onChanged: widget.onTextChanged,
- ),
- ),
- CupertinoButton(
- onPressed: widget.onBtnClear,
- padding: EdgeInsets.all(0),
- child: Icon(
- Icons.cancel,
- color: JXColors.k747A7E,
- size: 24.0,
- ),
- ),
- ]),
- ),
- );
- }
- }
|