123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- import 'package:flutter/material.dart';
- import 'package:taskservice/Common/JXColors.dart';
- void main() {
- runApp(MyApp());
- }
- class MyApp extends StatelessWidget {
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'JXZS',
- theme: ThemeData(
- // This is the theme of your application.
- //
- // Try running your application with "flutter run". You'll see the
- // application has a blue toolbar. Then, without quitting the app, try
- // changing the primarySwatch below to Colors.green and then invoke
- // "hot reload" (press "r" in the console where you ran "flutter run",
- // or simply save your changes to "hot reload" in a Flutter IDE).
- // Notice that the counter didn't reset back to zero; the application
- // is not restarted.
- primarySwatch: Colors.blue,
- // This makes the visual density adapt to the platform that you ru
- // the app on. For desktop platforms, the controls will be smaller and
- // closer together (more dense) than on mobile platforms.
- visualDensity: VisualDensity.adaptivePlatformDensity,
- ),
- home: MyHomePage(title: 'JXZS'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- // 参数
- /*空白区域键盘消失控制*/
- FocusNode blankNode = FocusNode();
- /*搜索值*/
- String _searchText;
- /*筛选列表数据*/
- void filterListView() {
- print('筛选:$_searchText');
- String text = _searchText;
- }
- /*显示列表*/
- List<Widget> theCellData() {
- List<Widget> widgets = [];
- for (int i = 0; i < 100; i++) {
- widgets.add(
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Text("Row $i"),
- )
- );
- }
- return widgets;
- }
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- FocusScope.of(context).requestFocus(blankNode);
- },
- child: Scaffold(
- appBar: AppBar(
- title: Text(widget.title),
- ),
- body: SafeArea(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Container(
- color: JXColors.kF0F0F0,
- alignment: Alignment.center,
- padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
- height: 50.0,
- child: Row(children: <Widget>[
- Container(
- width: 44.0,
- child: Icon(
- Icons.search,
- size: 24.0,
- )),
- Expanded(
- child: TextField(
- focusNode: blankNode,
- obscureText: false,
- cursorColor: JXColors.k1F2529,
- decoration: InputDecoration(
- border: InputBorder.none,
- hintText: '快速筛选',
- labelStyle: TextStyle(
- color: JXColors.k2E3032,
- fontSize: 18,
- ),
- ),
- onSubmitted: (value) {
- setState(() {
- _searchText = value;
- });
- filterListView();
- },
- ),
- ),
- ])),
- Expanded(
- flex: 1,
- child: Container(
- color: JXColors.kF0F0F0,
- child: ListView(children: theCellData()),
- )),
- Container(
- color: JXColors.kF0F0F0,
- height: 44.0,
- child: Row(
- children: <Widget>[
- Expanded(
- child: FlatButton(
- onPressed: () {
- print('新建会员');
- },
- padding: EdgeInsets.all(0),
- color: JXColors.kFFFFFF,
- textColor: JXColors.k1F2529,
- child: const Text('新建会员',
- style: TextStyle(fontSize: 14)),
- ),
- ),
- Expanded(
- child: FlatButton(
- onPressed: () {
- print('会员列表');
- },
- padding: EdgeInsets.all(0),
- color: JXColors.k1F2529,
- textColor: JXColors.kFFFFFF,
- child: const Text('会员列表',
- style: TextStyle(fontSize: 14)),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ));
- }
- }
|