Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

flutter-ui-essentials

FreeNo executable scriptsNot checked

Everyday details to get right while writing Flutter UI, such as text fields and forms, dates and numbers, missing values, network images, lists and scrolling…

kamranbekirovyzby kamranbekirovyz★ 139 GitHub stars

About this skill

Flutter UI Essentials

Write Flutter UI that follows the rules below.

How it works

  1. Read the rules below before writing any UI code.
  2. If the user ran the skill without giving a task, reply with only "Let's Flutter it 🩵" and wait. Do not ask what to build.
  3. While writing, apply every rule whose case shows up in the code you write.
  4. Only new code and code you are changing. Leave the rest of the app alone.
  5. When a rule needs a package, widget, helper or extension, look for one in the app that does the same job and use it. If there is none, add the package or build the piece once, wherever it fits best in the app's structure, then reuse it. When the rule gives the code, use it as is.
  6. When done, list the rules you applied and anything you added (packages, widgets, helpers, extensions), one line each.

Rules

Lists and scrolling

  • Don't wrap a scrollable list with SafeArea. It makes the content stop above the system bar instead of scrolling under it. Add BottomPadding as the last item instead, or use BottomPadding.of(context) as the bottom padding.
// As the last item
SingleChildScrollView(
  child: Column(
    children: [
      CategoriesList(),
      const BottomPadding(),
    ],
  ),
)

// As the bottom padding
ListView(
  padding: EdgeInsets.only(
    bottom: BottomPadding.of(context),
  ),
)

// The list already has padding: keep it, pass the same number as minimum
SingleChildScrollView(
  padding: const EdgeInsets.all(24).copyWith(
    bottom: BottomPadding.of(context, minimum: 24),
  ),
)
import 'package:flutter/widgets.dart';

class BottomPadding extends StatelessWidget {
  const BottomPadding({super.key});

  static double of(
    BuildContext context, {
    double minimum = 16,
  }) {
    // Get size of the bottom system bar
    final double viewPadding = MediaQuery.viewPaddingOf(context).bottom;

    // Use the system bar size if it's bigger than the minimum,
    // otherwise fall back to the minimum.
    final double height = viewPadding > minimum ? viewPadding : minimum;

    return height;
  }

  @override
  Widget build(BuildContext context) {
    final double height = of(context);

    // Return a box of that height.
    return SizedBox(height: height);
  }
}
  • When a page contains a horizontal list, don't put horizontal padding on the page's scroll view. That padding cuts the horizontal list off before the screen edge. Leave the page edge to edge, give each section its own horizontal padding, and put the padding of the horizontal list inside the list itself, so its items scroll all the way to the edge.
SingleChildScrollView(
  // no horizontal padding here
  child: Column(
    children: [
      const Padding(
        padding: EdgeInsets.symmetric(horizontal: 16),
        child: SectionTitle('New arrivals'),
      ),
      SizedBox(
        height: 318,
        child: ListView.separated(
          scrollDirection: Axis.horizontal,
          // the list has its own padding
          padding: const EdgeInsets.symmetric(horizontal: 16),
          itemCount: products.length,
          itemBuilder: (_, int index) {
            return ProductItem(product: products[index]);
          },
          separatorBuilder: (_, _) {
            return const SizedBox(width: 8);
          },
        ),
      ),
    ],
  ),
)
  • Wrap every list or page that scrolls up and down with Scrollbar. If the list has its own ScrollController, pass it to both. Skip it for PageView and wheel pickers.
Scrollbar(
  controller: controller,
  child: ListView.builder(
    controller: controller,
    ...
  ),
)
  • When a page gives its list its own ScrollController, wrap the Scaffold in a PrimaryScrollController with the same controller. On iOS a tap on the status bar scrolls the page to the top. Scaffold does that by itself, but it stops working once the list has its own controller, unless you hand that controller over like this.
PrimaryScrollController(
  controller: _scrollController, // pass here
  child: Scaffold(
    body: ListView(
      controller: _scrollController, // and to the list
      children: [
        // ...
      ],
    ),
  ),
)

Text

  • When you show a value that can be missing, never let the user see the word "null" or an empty spot. Use orPlaceholder() to show "-" instead, or isUsable to hide the widget. A value is missing when it is null, an empty string, or the text "null" that some backends send.
// Show a placeholder
Text(
  user.name.orPlaceholder(),
)

// Hide the widget
if (user.profession.isUsable)
  Text(
    user.profession!,
  )

// Not a String: call toString() first
Text(
  order.totalPrice.toString().orPlaceholder(),
)

// Something in the chain can be null: wrap all of it in parentheses
Text(
  (state.cartInfo?.totalPrice?.toString()).orPlaceholder(),
)
extension StringX on String? {
  bool get isUsable {
    return this != null && this!.isNotEmpty &
Full SKILL.md on GitHub

Install flutter-ui-essentials in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the flutter-ui-essentials skill do?

Everyday details to get right while writing Flutter UI, such as text fields and forms, dates and numbers, missing values, network images, lists and scrolling, and tap areas. Use before building or changing a Flutter screen, widget, form or list, or when the user invokes /flutter-ui-essentials.

How do I install the flutter-ui-essentials skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the flutter-ui-essentials skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare flutter-ui-essentials with