Flutter

How to create a toggle/switch button in Flutter?

≡放荡痞女 提交于 2021-02-11 14:15:17
问题 I'm looking for a way to add a toggel / switch button in Flutter but so far haven't found the desired result. I'm creating the layout for an APP as it's in the attached screenshot but stuck on the toggle / switch button part which will switch the language of the APP . 回答1: Here's how you can implement the toggle design you wanted : import 'package:flutter/material.dart'; import 'package:get/get.dart'; class AnimatedToggle extends StatefulWidget { final List<String> values; final ValueChanged

Flutter Firebase How to make Sequential Query

喜欢而已 提交于 2021-02-11 14:13:59
问题 I am developing a forum application. There are two collections related to user information and topic information in my Firebase database. In the forumTopics collection, I keep the data on each forum topic. When I make a Firebase query, I want to get the data of this topic along with the data of the user corresponding to the topicAuthorUID value. For example, I want to extract the name, avatar information from the document of the user whose topicAuthorUID value is XXX in the userData

how to validate email before enter to the home page flutter

北慕城南 提交于 2021-02-11 14:13:46
问题 i'm trying to validate my email before the user can enter to the home page. the problem is when i fill the email and password user with aaany thing it give the access without any check. here is my code for sign in page and this is the code of sign up screen 回答1: If it is all about validating the email for formatting , then what you can do is shown below. Put it in your email address validator you are submitting the data for Login/Register validator: (value){ Pattern pattern = r'^(([^<>()[\]\\

Flutter NoSuchMethodErro: The method 'tr' was called on null. Receiver: null

强颜欢笑 提交于 2021-02-11 14:10:46
问题 I am new in flutter, i am trying to localize languages, but getting error localizationsDelegates: <LocalizationsDelegate>[ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, EasyLocalizationDelegate( locale: data.locale ?? Locale('en', 'US'), path: 'resources/langs', ), ], supportedLocales: <Locale>[ const Locale("en", "US"), const Locale("ar", "AR"), ], getting error The method 'tr' was called on null. Receiver: null Tried

DataTable: Get the value of the first cell from a selected row

末鹿安然 提交于 2021-02-11 14:01:33
问题 I'm trying to delete a selected row from a DataTable by retrieving the value of the first cell (id) and passing it to the deleteRow function. How do I get this value? child: DataTable( columns: data.first.keys .map((dynamic keys) => DataColumn(label: Text(keys.toString()))) .toList(), rows: data.map((map) { return DataRow( onSelectChanged: (bool selected) { if (selected) { try { //determine the id of the selected row int selectedId = /*get index of selected row and return value of the first

How to manage add and update data in Firebase

喜欢而已 提交于 2021-02-11 14:01:29
问题 I'm using Flutter. I would like to add data at first. If email or uid had been registered, I want to update data01/02 or add data01/02. How can I specify the initial data. _firestore.collection('members').add({ 'uid': loginUser.uid, 'email': loginUser.email, 'data01': { 'name': name, 'img_url': 'https://www.xxx.xxx/xxx.png', 'data02': { 'phone': phone, } } Please give me advice. 回答1: Assuming you set your document name to your loginUser.uid you can use: String rawJson = '{ "email": loginUser

Flutter Firebase Loop over collection in a document [duplicate]

自作多情 提交于 2021-02-11 14:01:10
问题 This question already has an answer here : Using Flutter Firestore plug in, do something for each sub collection in a document (1 answer) Closed last year . I have this path in my Database: /messages/tT2Q16n1FMZoTNZQOejtWuJdCmD2/ZqihbgR7skcytLAe88fQecmxcIc2-tT2Q16n1FMZoTNZQOejtWuJdCmD2/1579626761580 and from here I have to get content . I am trying this: var snapshot = Firestore.instance.collection('messages').document(user.id).snapshots(); but how can I loop over these items and get content

Is it possible to use additional providers for firebase authentication?

一笑奈何 提交于 2021-02-11 13:51:00
问题 Apart from the existing providers, is it possible to use an additional provider for firebase authentication? I am using Flutter . Any detail explanation will be highly appreciated. 回答1: You can indeed create a custom provider for Firebase Authentication. The process on Flutter is mostly the same as on other platforms: You sign the user in the custom backend or provider, and get credentials from that. This step is not related to Firebase in any way. You pass the credentials to a custom trusted

how to fix E/flutter (15862): Unhandled Exception: Bad state: No element when push data to firebase in flutter?

亡梦爱人 提交于 2021-02-11 13:50:30
问题 i trying to send data to firebase i did every thing this my code my code the modal import 'package:firebase_database/firebase_database.dart'; class Student { String _id; String _name; String _age; String _city; String _department; String _description; Student(this._id, this._name, this._age, this._city, this._department, this._description); Student.map(dynamic obj) { this._id = obj['id']; this._name = obj['name']; this._age = obj['age']; this._city = obj['city']; this._department = obj[

how to set distance between users using Geolocator in flutter

坚强是说给别人听的谎言 提交于 2021-02-11 13:46:31
问题 I am currently trying to give access to users to do something when users are in radius x meters from position that I have determined. So, what I mean is.. I declare a position with x latitude and y longitude.. and then if users position is 500 meters from position that I have declare, they can access something else... is there a way to do that? here is part of my code Position _mine; Future _searchMe() async { if ((await Geolocator().isLocationServiceEnabled())) { final Geolocator geolocator