| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import 'package:flutter/material.dart';
- import 'package:jmrh/constant/styles.dart';
- class Search extends StatefulWidget {
- Search({Key key}) : super(key: key);
- @override
- _SearchState createState() => _SearchState();
- }
- class _SearchState extends State<Search> {
- TextEditingController _controller;
- @override
- void initState() {
- super.initState();
- _controller = TextEditingController();
- }
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: CustomScrollView(
- slivers: [
- SliverAppBar(
- brightness: Brightness.light,
- pinned: true,
- backgroundColor: Colors.white,
- iconTheme: IconTheme.of(context).copyWith(color: Colors.black),
- title: appbarTitle('搜索'),
- leading: IconButton(
- icon: ImageIcon(
- AssetImage('img/nav_icon_return.png'),
- size: 28,
- ),
- onPressed: () {
- Navigator.pop(context);
- },
- ),
- bottom: PreferredSize(
- child: Row(
- children: [
- Expanded(
- child: Container(
- height: 36,
- decoration: BoxDecoration(
- color: COLOR_INPUT_BG,
- borderRadius: BorderRadius.all(Radius.circular(2))),
- margin: EdgeInsets.only(left: 16),
- padding: EdgeInsets.symmetric(horizontal: 10),
- child: Row(
- children: [
- Image.asset('img/icon_search.png'),
- Expanded(
- child: Container(
- margin: EdgeInsets.only(left: 10, right: 10),
- child: TextField(
- controller: _controller,
- decoration: InputDecoration.collapsed(
- hintText: '搜索...',
- ),
- onSubmitted: (String value) async {
- await showDialog<void>(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: const Text('Thanks!'),
- content:
- Text('You typed "$value".'),
- actions: <Widget>[
- FlatButton(
- onPressed: () {
- Navigator.pop(context);
- },
- child: const Text('OK'),
- ),
- ],
- );
- },
- );
- },
- )),
- ),
- ],
- ),
- ),
- ),
- Container(
- width: 60,
- child: FlatButton(
- child: Text(
- '搜索',
- style: TextStyle(color: COLOR_PRIMARY, fontSize: 14),
- ),
- onPressed: () {},
- ),
- )
- ],
- ),
- preferredSize: Size.fromHeight(36)),
- )
- ],
- ),
- );
- }
- }
|