build method

  1. @override
Widget build(
  1. BuildContext context,
  2. RockModel model
)
override

Builds the UI according to the state in model.

Implementation

@override
Widget build(BuildContext context, RockModel model) => ListView(
  shrinkWrap: true,
  children: [
    Row(
      children: [
        Text(
          "Rocks & Minerals",
          style: context.textTheme.headlineMedium,
        ),
        const Spacer(),
        ViewsSelector(index: index),
      ],
    ),
    Padding(
      padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
      child: SearchBar(
        hintText: "Search for a rock or characteristic",
        hintStyle: WidgetStatePropertyAll(context.textTheme.bodyMedium),
        controller: model.controller,
        onChanged: model.search,
      ),
    ),
    for (final rock in model.filteredRocks)
      RockWidget(rock),
  ],
);