Your Second Flutter App

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

Part 4: Filter Results

25. Create a Filter Widget

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: 24. Introduction Next episode: 26. Build Out the Filter Page

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've reached locked video content where the transcript will be shown as obfuscated text.

The FilterPage consists of a series of tech domains that the user might be most interested in. You’ll let the user either show all the domains, or just filter down to one particular domain. To help with creating the FilterPage and keep its code nice and tidy, in this episode you’ll create a FilterWidget that displays a filter value. The FilterPage will then consist of a set of these filter widgets.

class FilterWidget extends StatelessWidget {
}
import 'package:flutter/material.dart';
final int value;
final int groupValue;
final ValueChanged<int?> onChanged;
final String text;
  const FilterWidget(
      {Key? key,
      required this.value,
      required this.groupValue,
      required this.onChanged,
      required this.text})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Radio(
          value: value,
          groupValue: groupValue,
          onChanged: onChanged,
        ),
        Text(
          text,
          style: const TextStyle(fontSize: 16.0),
        ),
      ],
    );
  }