No rerender after setStateFlutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewOpening a new view inside of ListTile - FlutterFlutter list view rendering issueFlutter and Firestore, handle data from StreamBuilderFlutter / FireStore is there a 'right' class or approach to reordering ListTiles created from a Firestore databaseHow to refresh flutter UI on AlertDialog close?ExpansionTile - how to collapse other tiles, hide keyboard on pressFlutter: onTap not producing the ListView.Builder when trailing icon tapped in ListTileHow to pass specific ListTile variables to new page route onTap?
What are one's options when facing religious discrimination at the airport?
PhD Length: are shorter PhD degrees (from different countries) valued differently in other counter countries where PhD Is a longer process?
Can Familiars read and use spell scrolls?
Sending mail to the Professor for PhD, after seeing his tweet
Would an object shot from earth fall into the sun?
Is the "spacetime" the same thing as the mathematical 4th dimension?
Why such a singular place for bird watching?
How to identify whether a publisher is genuine or not?
What is the meaning of first flight and introduction in aircraft production?
Are there types of animals that can't make the trip to space? (physiologically)
GPLv3 forces us to make code available, but to who?
Airport Security - advanced check, 4th amendment breach
What does "execute a hard copy" mean?
How to transcribe an arpeggiated 4-note chord to be playable on a violin?
What action is recommended if your accommodation refuses to let you leave without paying additional fees?
Does the 'java' command compile Java programs?
Bothered by watching coworkers slacking off
Parent asking for money after moving out
Why the first octet of a MAC address always end with a binary 0?
Realistically, how much do you need to start investing?
Could the Queen overturn the UK Supreme Court ruling regarding prorogation of Parliament?
How do we know neutrons have no charge?
How to say "respectively" in German when listing (enumerating) things
Can anyone give me the reason why music is taught this way?
No rerender after setState
Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewOpening a new view inside of ListTile - FlutterFlutter list view rendering issueFlutter and Firestore, handle data from StreamBuilderFlutter / FireStore is there a 'right' class or approach to reordering ListTiles created from a Firestore databaseHow to refresh flutter UI on AlertDialog close?ExpansionTile - how to collapse other tiles, hide keyboard on pressFlutter: onTap not producing the ListView.Builder when trailing icon tapped in ListTileHow to pass specific ListTile variables to new page route onTap?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.
The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart
I simply edited this part in the _pushSaved() methode:
final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);
I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.
setState(()
_saved.remove(pair);
this.build(context);
);
Appreciate your help!
dart flutter
add a comment
|
I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.
The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart
I simply edited this part in the _pushSaved() methode:
final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);
I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.
setState(()
_saved.remove(pair);
this.build(context);
);
Appreciate your help!
dart flutter
1
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04
add a comment
|
I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.
The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart
I simply edited this part in the _pushSaved() methode:
final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);
I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.
setState(()
_saved.remove(pair);
this.build(context);
);
Appreciate your help!
dart flutter
I'm getting started with flutter and did this guide (https://flutter.dev/docs/get-started/codelab). I wanted to extend this app by providing the option to unselect saved entrys. My code works in that sense that you can unselect entrys but the 'Saved Suggestions' list is not rerendered after a tap on the icon.
The whole code can be found here: https://gist.githubusercontent.com/Sfshaza/a95ff8ed0473073197d28437c8d68492/raw/6fb529524047c8c093cb6212dfb66635202ba272/main.dart
I simply edited this part in the _pushSaved() methode:
final Iterable<ListTile> tiles = _saved.map(
(WordPair pair)
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
Icons.favorite,
color: Colors.red,
),
onTap: ()
setState(()
_saved.remove(pair);
);
,
);
,
);
I read setState() reruns the build() methode but the methode _pushSaved() does not seem to be rerun. Is this because _pushSaved() is only run when the onPressed event is triggered by pressing on the list icon? I tried to rerun the build method manually after removing the word pair but it didn't work.
setState(()
_saved.remove(pair);
this.build(context);
);
Appreciate your help!
dart flutter
dart flutter
asked Mar 28 at 20:47
mxcxxmxcxx
183 bronze badges
183 bronze badges
1
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04
add a comment
|
1
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04
1
1
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406611%2fno-rerender-after-setstate%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406611%2fno-rerender-after-setstate%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
it's calling setState but on the first widget, you should extract the Saved Suggestions widget in a separated StatefulWidget
– diegoveloper
Mar 28 at 21:04