Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footer widget doesn't work as intended #194

Open
zigapovhe opened this issue Oct 9, 2023 · 2 comments
Open

Footer widget doesn't work as intended #194

zigapovhe opened this issue Oct 9, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@zigapovhe
Copy link

Describe the bug
Footer is only visible at the end of GroupedListView, and as such, doesn't really give any added value to the package. It should add footer widget to the end of each section.

Expected behavior
Based on this issue #28, the expected behavior would be, to see footer widget at the end of each section (group)

Information:

  • Dart version: 3.1.3
  • Flutter version: 3.13.6
  • Platform: macOS 14.0
  • Package version: 5.1.3 (46c861d)

I've used the code from your example.dart file
Screenshot 2023-10-09 at 21 59 33
Screenshot 2023-10-09 at 22 05 19

import 'package:flutter/material.dart';
import 'package:grouped_list/grouped_list.dart';

void main() => runApp(const MyApp());

List _elements = [
  {'name': 'John', 'group': 'Team A'},
  {'name': 'Will', 'group': 'Team B'},
  {'name': 'Beth', 'group': 'Team A'},
  {'name': 'Miranda', 'group': 'Team B'},
  {'name': 'Mike', 'group': 'Team C'},
  {'name': 'Danny', 'group': 'Team C'},
];

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Grouped List View Example'),
        ),
        body: _createGroupedListView(),
      ),
    );
  }

  _createGroupedListView() {
    return GroupedListView<dynamic, String>(
      elements: _elements,
      footer: Container(color: Colors.red, child: const Text('This is footer widget')),
      groupBy: (element) => element['group'],
      groupComparator: (value1, value2) => value2.compareTo(value1),
      itemComparator: (item1, item2) => item1['name'].compareTo(item2['name']),
      order: GroupedListOrder.DESC,
      useStickyGroupSeparators: true,
      groupSeparatorBuilder: (String value) => Padding(
        padding: const EdgeInsets.all(8.0),
        child: Text(
          value,
          textAlign: TextAlign.center,
          style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
        ),
      ),
      itemBuilder: (c, element) {
        return Card(
          elevation: 8.0,
          margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 6.0),
          child: SizedBox(
            child: ListTile(
              contentPadding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
              leading: const Icon(Icons.account_circle),
              title: Text(element['name']),
              trailing: const Icon(Icons.arrow_forward),
            ),
          ),
        );
      },
    );
  }
}
@zigapovhe zigapovhe added the bug Something isn't working label Oct 9, 2023
@zigapovhe
Copy link
Author

Can be closed, as I've fixed it in my own fork. @Dimibe If you want, I can make a PR for it, but for me, it does the job: zigapovhe@96e800f

@Dimibe
Copy link
Owner

Dimibe commented Oct 27, 2023

@zigapovhe:
I would appreciate it if you could open a PR. I will then decide if I want to add the feature to the package or not.
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants