| child: Padding( | child: Padding( | ||||
| padding: const EdgeInsets.only(right: 8, top: 8, bottom: 0), | padding: const EdgeInsets.only(right: 8, top: 8, bottom: 0), | ||||
| child: Container( | child: Container( | ||||
| decoration: BoxDecoration( | |||||
| color: Colors.white, | |||||
| borderRadius: const BorderRadius.all( | |||||
| Radius.circular(38.0), | |||||
| ), | |||||
| boxShadow: <BoxShadow>[ | |||||
| BoxShadow( | |||||
| color: Colors.grey.withOpacity(0.2), | |||||
| offset: const Offset(0, 2), | |||||
| blurRadius: 8.0), | |||||
| ], | |||||
| ), | |||||
| child: Padding( | child: Padding( | ||||
| padding: const EdgeInsets.only( | padding: const EdgeInsets.only( | ||||
| left: 16, right: 16, top: 4, bottom: 4), | left: 16, right: 16, top: 4, bottom: 4), | ||||
| onChanged: (String txt) {}, | onChanged: (String txt) {}, | ||||
| cursorColor: AppColors.GRAY1, | cursorColor: AppColors.GRAY1, | ||||
| decoration: InputDecoration( | decoration: InputDecoration( | ||||
| border: InputBorder.none, | |||||
| hintText: 'Tìm kiếm ...', | |||||
| suffixIcon: Icon( | |||||
| Icons.search, | |||||
| size: 30, | |||||
| ), | |||||
| hintText: 'Tìm thiết bị', | |||||
| hintStyle: TextStyle(color: Colors.grey[500]), | |||||
| ), | ), | ||||
| onSubmitted: widget.searchPressed, | onSubmitted: widget.searchPressed, | ||||
| ), | ), |
| import 'package:farm_tpf/data/repository/repository.dart'; | import 'package:farm_tpf/data/repository/repository.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/app_bar_widget.dart'; | |||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_search.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_search.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/control_device/widget_device_list.dart'; | import 'package:farm_tpf/presentation/screens/control_device/widget_device_list.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
| _blocContext = context; | _blocContext = context; | ||||
| return Scaffold( | return Scaffold( | ||||
| appBar: AppBar( | |||||
| centerTitle: true, | |||||
| title: Text("Điều khiển thiết bị"), | |||||
| backgroundColor: Colors.white, | |||||
| appBar: AppBarWidget( | |||||
| isBack: false, | |||||
| ), | ), | ||||
| body: BlocProvider<DeviceBloc>( | body: BlocProvider<DeviceBloc>( | ||||
| create: (context) => | create: (context) => | ||||
| Widget _buildContent() { | Widget _buildContent() { | ||||
| return Column( | return Column( | ||||
| crossAxisAlignment: CrossAxisAlignment.start, | |||||
| children: [ | children: [ | ||||
| Padding( | |||||
| padding: const EdgeInsets.all(8.0), | |||||
| child: Text( | |||||
| 'Thiết bị', | |||||
| style: TextStyle(fontWeight: FontWeight.w500, fontSize: 22), | |||||
| ), | |||||
| ), | |||||
| Padding( | |||||
| padding: const EdgeInsets.all(8.0), | |||||
| child: Text('Điều khiển thiết bị từ xa', | |||||
| style: TextStyle( | |||||
| fontSize: 15, | |||||
| fontWeight: FontWeight.w200, | |||||
| color: Colors.black54)), | |||||
| ), | |||||
| SearchWidget(searchPressed: (value) { | SearchWidget(searchPressed: (value) { | ||||
| FocusScope.of(context).requestFocus(FocusNode()); | FocusScope.of(context).requestFocus(FocusNode()); | ||||
| _deviceBloc.add(OnSearch(query: value)); | _deviceBloc.add(OnSearch(query: value)); |
| onTap: () { | onTap: () { | ||||
| //Navigator.of(context).push(MaterialPageRoute(builder: (context) => DeviceDetail(device: _device,))); | //Navigator.of(context).push(MaterialPageRoute(builder: (context) => DeviceDetail(device: _device,))); | ||||
| }, | }, | ||||
| child: Card( | |||||
| child: Container( | |||||
| decoration: BoxDecoration( | |||||
| border: | |||||
| Border(bottom: BorderSide(color: Colors.grey, width: 0.35))), | |||||
| child: ListTile( | child: ListTile( | ||||
| leading: powerBtn(item, context), | |||||
| title: Text( | |||||
| '${item.name} - ${item.location ?? ''}', | |||||
| style: TextStyle( | |||||
| color: Colors.black54, fontSize: 13, fontWeight: FontWeight.bold), | |||||
| ), | |||||
| subtitle: widgetStatus(item), | |||||
| )), | |||||
| title: Text( | |||||
| '${item.name} - ${item.location ?? ''}', | |||||
| style: TextStyle( | |||||
| color: Colors.black54, | |||||
| fontSize: 15, | |||||
| fontWeight: FontWeight.bold), | |||||
| ), | |||||
| subtitle: widgetStatus(item), | |||||
| trailing: powerBtn(item, context), | |||||
| )), | |||||
| ); | ); | ||||
| } | } | ||||