mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
Give some widgets keys
This should result in a bit of a performance boost. I'm not sure if I understand the concept of keys correctly, though.
This commit is contained in:
@ -36,7 +36,11 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
|
||||
controller: pageController,
|
||||
itemCount: widget.notes.length,
|
||||
itemBuilder: (BuildContext context, int pos) {
|
||||
return NoteViewer(note: widget.notes[pos]);
|
||||
var note = widget.notes[pos];
|
||||
return NoteViewer(
|
||||
key: ValueKey("Viewer_" + note.filePath),
|
||||
note: widget.notes[pos],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@ -114,7 +118,7 @@ class NoteViewer extends StatelessWidget {
|
||||
final Note note;
|
||||
final _biggerFont = const TextStyle(fontSize: 18.0);
|
||||
|
||||
const NoteViewer({@required this.note});
|
||||
const NoteViewer({Key key, @required this.note}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -31,7 +31,7 @@ class JournalList extends StatelessWidget {
|
||||
|
||||
var note = notes[i];
|
||||
return Dismissible(
|
||||
key: Key(note.filePath),
|
||||
key: ValueKey("JournalList_" + note.filePath),
|
||||
child: _buildRow(context, note, i),
|
||||
background: Container(color: Theme.of(context).accentColor),
|
||||
onDismissed: (direction) {
|
||||
@ -60,7 +60,6 @@ class JournalList extends StatelessWidget {
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
|
||||
var tile = ListTile(
|
||||
key: ValueKey(journal.filePath),
|
||||
isThreeLine: true,
|
||||
title: Text(
|
||||
title,
|
||||
|
Reference in New Issue
Block a user