Your Second Flutter App

Nov 30 2021 · Dart 2.13, Flutter 2.2.3, Visual Studio Code

Part 4: Filter Results

26. Build Out the Filter Page

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 25. Create a Filter Widget Next episode: 27. Challenge: Add a Filter

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In the last episode, you created a singular widget to filter out the result of the courses. Now it’s time to create a page for these widgets. Here’s what the final result will look like.

int _filterValue = Constants.allFilter;
import '../../constants.dart';
void _handleRadioValueChange(int? value) {
  setState(() {
    _filterValue = value ?? 0;
  });
}
import 'filter_widget.dart';
return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text(Strings.filter),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            FilterWidget(
              value: Constants.iosFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.ios,
            ),
            FilterWidget(
              value: Constants.androidFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.android,
            ),
            FilterWidget(
              value: Constants.sssFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.sss,
            ),
            FilterWidget(
              value: Constants.unityFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.unity,
            ),
            FilterWidget(
              value: Constants.macosFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.macos,
            ),
            FilterWidget(
              value: Constants.allFilter,
              groupValue: _filterValue,
              onChanged: _handleRadioValueChange,
              text: Strings.all,
            ),
          ],
        ),