Skip to content

Update only the New Selected and the Previous Selected widget on a list view #1167

Answered by TimWhiting
b4ltz asked this question in Q&A
Discussion options

You must be logged in to vote

Use .select

class MyWidget extends ConsumerWidget {
  const MyWidget ({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    // Formatter for srp
    final formatter = ref.watch(formatterProvider);
    // Current index of the FormData
    final index = ref.watch(currentFormDataIndex);
    // Current FormData in the listView
    final data = ref.watch(currentFormData);
    // Search query
    final query = ref.watch(queryFormDataProvider);
    // Whether this is the currently selected formdata
    final isSelected = ref.watch(selectedFormDataProvider.select((value) => value?.data == data));

    return ListTile(
      selectedTileColor: 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@b4ltz
Comment options

@TimWhiting
Comment options

@b4ltz
Comment options

Answer selected by b4ltz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants