Posts

Showing posts with the label flutter

Warp text on a row with an input

Image
Warp text on a row with an input I have a situation where I need to wrap text with an input in Flutter. An example: 'The cat goes <TextField> , the dog goes bark.' <TextField> I'm using the Row class to format it this way, however, the row class doesn't wrap text. Widget _buildQuestionText(String sentence) { List splitSentence = sentence.split('$guess'); return new Container( child: Row( children: <Widget>[ new Text(splitSentence[0]), new Expanded(child: new TextField()), new Text(splitSentence[1]), ] ), ); } Which creates: I have looked at using the Flex class but was unable to achieve the format I wanted. How can I achieve text wrapping with an input in the middle of text? Just to be clear, are you trying to make multiple bits of text that each wrap, or do you want an entire sentence with an input in the middle of it with the entire thing wrapping? ...

Flutter search bar with autocomplete

Flutter search bar with autocomplete I'm looking for search bar in flutter docs but cant found it, is there widget for the search bar with auto complete in appbar. For example, i have the icon search on top at appbar. When press it show the search box,when start typing show autocomplete same like dropdown with listtile. I manage to found this but not easy to use because i need dropdown show suggestion autocomplete ,then use the suggestion for new route if selected. Here the search action here the example image what i want to achieve you can take a look on how to implement with wiki flutter as an example github.com/namiwang/wiki-flutter – user1462442 Apr 26 at 23:44 thanks..another solution found but yet still not satisfy my need stackoverflow.com/questions/49966980/… . Maybe need a tw...

My async call is returning before list is populated in forEach loop

My async call is returning before list is populated in forEach loop I have a routine which gets a list of filenames from the device, then reads the file(s) to build a list. However, the calling routine always returns with zero items. I print the filenames, so I know they exist, however, it appears that the async is returning before I read the files. I used similar code when making an HTTP call. But, something here is causing the routine to return the list even though it hasn't completed. Perhaps, it is possible that I am calling it at the wrong time? I am calling retrieveItems here: @override void initState() { super.initState(); retrieveItems(); } Eventually I will have a refresh button, but for now I'd simply like the list to populate with the data from the files... Callee Future<List<String>> readHeaderData() async { List<String> l = new List(); List<String> files = await readHeaders(); // Gets filenames files.forEach((filename...

Flutter: StreamBuilder uses old stream instead of new stream

Flutter: StreamBuilder uses old stream instead of new stream I'm trying to show a Google-Firestore real-time list on my Flutter app using Flutter's StreamBuilder. However, the stream seems to be using both the old data and the new data, instead of just the new one. (See below) //This is the widget with the stream Expanded( child: StreamBuilder<QuerySnapshot>( stream: _firestoreInstance.collection("seeks").document('145725').collection("classes").document(_chosenClass) .collection("classTopics").document(date).collection("dateTopics").snapshots(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot){ if (!snapshot.hasData) return Text('Loading...'); return ListView( children: snapshot.data.documents.map((DocumentSnapshot document){ debugPrint("DOCCUMENT ID: ${document.documentID} AND topic...