Size: a a a

Dart & Flutter по-русски

2020 March 17

А

Андрей in Dart & Flutter по-русски
طاهر
Привет 👋 как с помощью ListView.builder задать настройку, чтобы itemBuilder выводил только те элементы из списка, где есть, например, status: StatusModel.active ?( всего возможны active, delivered и тд)
передавать список в builder с .where?
источник

RV

Roman Vasiliev in Dart & Flutter по-русски
Container() как один из вариантов
источник

S

Sasha in Dart & Flutter по-русски
Андрей
ну, кусок кода, думаю, всё-таки был бы полезнее для того, чтобы понять, что происходит
Минуту
источник

ط

طاهر in Dart & Flutter по-русски
Андрей
передавать список в builder с .where?
это как?
сейчас код выглядит вот так
источник

А

Андрей in Dart & Flutter по-русски
طاهر
это как?
сейчас код выглядит вот так
источник

S

Sasha in Dart & Flutter по-русски
Андрей
ну, кусок кода, думаю, всё-таки был бы полезнее для того, чтобы понять, что происходит
@override
 Widget build(BuildContext context) {
   return Scaffold(
     body: SafeArea(
       top: false,
       child: Stack(
         children: <Widget>[
           GoogleMap(
             myLocationEnabled: true,
             myLocationButtonEnabled: false,
             mapType: MapType.normal,
             initialCameraPosition: _kGooglePlex,
             mapToolbarEnabled: false,
             onMapCreated: (GoogleMapController controller) {
               _controller.complete(controller);
             },
             onTap: (position) {
               setState(() {
                 _markers = <Marker>[
                   Marker(
                     markerId: MarkerId('marker'),
                     position: LatLng(position.latitude, position.longitude),
                     draggable: true,
                   ),
                 ];
               });
               print(position.latitude);
               print(position.longitude);
             },
             markers: _markers.length > 0 ? _markers.toSet() : null,
             onCameraMove: (cameraPosition) {},
           ),
           Positioned(
             top: 0,
             child: Container(
               padding: EdgeInsets.only(top: 14),
               width: MediaQuery.of(context).size.width,
               decoration: BoxDecoration(
                 gradient: LinearGradient(
                   colors: <Color>[Color(0xFF68BB49), Colors.transparent],
                   begin: Alignment.topCenter,
                   end: Alignment.bottomCenter,
                 ),
               ),
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: <Widget>[
                   IconButton(
                     onPressed: () {
                       Navigator.pop(context);
                     },
                     icon: Icon(
                       Icons.arrow_back_ios,
                       color: Color(0xFF68BB49),
                     ),
                   ),
                   Text(
                     'Карта',
                     style: TextStyle(
                       fontSize: 18,
                       color: Color(0xFF68BB49),
                     ),
                   ),
                   Container(
                     width: 50,
                   ),
                 ],
               ),
             ),
           ),
         ],
       ),
     ),
     floatingActionButton: FloatingActionButton(
       child: Icon(Icons.my_location),
       onPressed: _findLocation,
     ),
     bottomSheet: AnimatedContainer(
       curve: Curves.easeIn,
       duration: Duration(milliseconds: 100),
       height: 230,
       width: MediaQuery.of(context).size.width,
       child: Column(
         children: <Widget>[
           Padding(
             padding: const EdgeInsets.only(
               top: 16.0,
               right: 16.0,
               bottom: 0,
               left: 16.0,
             ),
             child: Text(
               'Место проведения работы',
               style: TextStyle(
                 fontSize: 16.0,
               ),
             ),
           ),
           RadioListTile(
             controlAffinity: ListTileControlAffinity.trailing,
             activeColor: Color(0xFF00AE68),
             title: Text(
               'Территория заказчика',
               style: TextStyle(
                 fontSize: 18.0,
                 color: Color(0xFF68BB49),
               ),
             ),
             value: false,
             groupValue: isRemote,
             onChanged: (bool value) {
               print(value);
               setState(() {
                 isRemote = value;
               });
             },
           ),
           RadioListTile(
             controlAffinity: ListTileControlAffinity.trailing,
             activeColor: Color(0xFF00AE68),
             title: Text(
               'Удаленно',
               style: TextStyle(
источник

S

Sasha in Dart & Flutter по-русски
Андрей
ну, кусок кода, думаю, всё-таки был бы полезнее для того, чтобы понять, что происходит
fontSize: 18.0,
                 color: Color(0xFF68BB49),
               ),
             ),
             value: true,
             groupValue: isRemote,
             onChanged: (bool value) {
               setState(() {
                 isRemote = value;
               });
               print(isRemote);
             },
           ),
           Padding(
             padding: const EdgeInsets.symmetric(horizontal: 16.0),
             child: TextFormField(
               controller: _addressController,
               enabled: !isRemote,
               decoration: InputDecoration(
                 labelText: 'Адрес',
                 hintText: 'Укажите адрес',
                 counterText: '${_addressController.text.length}/10',
                 counterStyle: TextStyle(
                   color: _addressController.text.length >= 10
                       ? Theme.of(context).primaryColor
                       : null,
                 ),
                 labelStyle: TextStyle(
                   fontSize: 18.0,
                   color: Color(0xFF68BB49),
                 ),
               ),
               onChanged: (val) {
                 setState(() {});
               },
             ),
           ),
           SizedBox(
             height: 10,
           ),
         ],
       ),
     ),
     floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
   );
источник

А

Андрей in Dart & Flutter по-русски
такие длинные куски кода на гитхаб лучше отдельным файликов отправлять, чем сюда
источник

S

Sasha in Dart & Flutter по-русски
Sasha
fontSize: 18.0,
                 color: Color(0xFF68BB49),
               ),
             ),
             value: true,
             groupValue: isRemote,
             onChanged: (bool value) {
               setState(() {
                 isRemote = value;
               });
               print(isRemote);
             },
           ),
           Padding(
             padding: const EdgeInsets.symmetric(horizontal: 16.0),
             child: TextFormField(
               controller: _addressController,
               enabled: !isRemote,
               decoration: InputDecoration(
                 labelText: 'Адрес',
                 hintText: 'Укажите адрес',
                 counterText: '${_addressController.text.length}/10',
                 counterStyle: TextStyle(
                   color: _addressController.text.length >= 10
                       ? Theme.of(context).primaryColor
                       : null,
                 ),
                 labelStyle: TextStyle(
                   fontSize: 18.0,
                   color: Color(0xFF68BB49),
                 ),
               ),
               onChanged: (val) {
                 setState(() {});
               },
             ),
           ),
           SizedBox(
             height: 10,
           ),
         ],
       ),
     ),
     floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
   );
build метод скрина
источник

S

Sasha in Dart & Flutter по-русски
Андрей
такие длинные куски кода на гитхаб лучше отдельным файликов отправлять, чем сюда
в данный момент не могу(((
источник

S

Sasha in Dart & Flutter по-русски
плохой интернет не позволяет
источник

А

Андрей in Dart & Flutter по-русски
Sasha
fontSize: 18.0,
                 color: Color(0xFF68BB49),
               ),
             ),
             value: true,
             groupValue: isRemote,
             onChanged: (bool value) {
               setState(() {
                 isRemote = value;
               });
               print(isRemote);
             },
           ),
           Padding(
             padding: const EdgeInsets.symmetric(horizontal: 16.0),
             child: TextFormField(
               controller: _addressController,
               enabled: !isRemote,
               decoration: InputDecoration(
                 labelText: 'Адрес',
                 hintText: 'Укажите адрес',
                 counterText: '${_addressController.text.length}/10',
                 counterStyle: TextStyle(
                   color: _addressController.text.length >= 10
                       ? Theme.of(context).primaryColor
                       : null,
                 ),
                 labelStyle: TextStyle(
                   fontSize: 18.0,
                   color: Color(0xFF68BB49),
                 ),
               ),
               onChanged: (val) {
                 setState(() {});
               },
             ),
           ),
           SizedBox(
             height: 10,
           ),
         ],
       ),
     ),
     floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
   );
я смотрю ты используешь AnimatedContainer, может быть дело в том, что клавиатура начинает открываться когда ещё происходит анимация, но это только догадка
источник

В

Вадим in Dart & Flutter по-русски
подскажите такую вещь
если переходишь на новую страницу с помощью Navigator.of(context).push();, то страница, с которой уходишь, должна dipose вызывать?
источник

А

Андрей in Dart & Flutter по-русски
а вообще, сравнительно недавно сделали виджет под твою задачу
источник

А

Андрей in Dart & Flutter по-русски
насколько я понял, как в гугл/apple картах
источник

I

Ivan in Dart & Flutter по-русски
Вадим
подскажите такую вещь
если переходишь на новую страницу с помощью Navigator.of(context).push();, то страница, с которой уходишь, должна dipose вызывать?
вроде да
источник

I

Ivan in Dart & Flutter по-русски
но для уверенности пропиши принт
источник

В

Вадим in Dart & Flutter по-русски
если не вызывается, то какие могут быть причины?
источник

S

Sasha in Dart & Flutter по-русски
Андрей
я смотрю ты используешь AnimatedContainer, может быть дело в том, что клавиатура начинает открываться когда ещё происходит анимация, но это только догадка
по пробую убрать
источник

RM

Rodion Mostovoy in Dart & Flutter по-русски
Товарищи, а с такой проблемой кто-то сталкивался?
_TypeError
type '_OneByteString' is not a subtype of type 'Map<dynamic, dynamic>'
источник