Fliin
On this page

Blocks / account

Account card

Introduces the signed-in person above the topics of their account: avatar, name and address, and opens the account on tap.

16 of 16 variants pass
Account card, pressable state
Platform
Brightness
Text scale
Direction

Import

Account card is part of Fliin Pro. With a license key, sign in once with fliin login, then add it in a Flutter app where fliin init has run:

fliin login
fliin add profile-card

Also installs: core, avatar, list-row, surface

Examples

Pressable

The account at the top of a settings screen: avatar, name and email. With onPressed, it opens the profile.

Account card, pressable state
import 'package:your_app/ui/fliin/components/avatar/fl_avatar.dart';
import 'package:your_app/ui/fliin/components/profile_card/fl_profile_card.dart';
import 'package:flutter/widgets.dart';

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

  @override
  Widget build(BuildContext context) {
    return FlProfileCard(
      avatar: const FlAvatar(initials: 'CM', semanticLabel: 'Camille Martin'),
      name: 'Camille Martin',
      detail: '[email protected]',
      onPressed: () {},
    );
  }
}

Static

Without onPressed, the card only shows who it is about: someone else’s profile, a member of a list.

Account card, static state
import 'package:your_app/ui/fliin/components/avatar/fl_avatar.dart';
import 'package:your_app/ui/fliin/components/profile_card/fl_profile_card.dart';
import 'package:flutter/widgets.dart';

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

  @override
  Widget build(BuildContext context) {
    return const FlProfileCard(
      avatar: FlAvatar(
        initials: 'YB',
        semanticLabel: 'Yasmine Benali',
        color: FlAvatarColor.success,
        variant: FlAvatarVariant.soft,
      ),
      name: 'Yasmine Benali',
      detail: '@yasmine',
    );
  }
}

Trailing

A member with their plan in tag and an action in trailing, in place of the chevron: the button keeps its own node, the card reads the rest.

Account card, trailing state
import 'package:your_app/ui/fliin/components/avatar/fl_avatar.dart';
import 'package:your_app/ui/fliin/components/button/fl_button.dart';
import 'package:your_app/ui/fliin/components/chip/fl_chip.dart';
import 'package:your_app/ui/fliin/components/profile_card/fl_profile_card.dart';
import 'package:flutter/widgets.dart';

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

  @override
  Widget build(BuildContext context) {
    return FlProfileCard(
      avatar: const FlAvatar(
        initials: 'LD',
        semanticLabel: 'Leah Doyle',
        color: FlAvatarColor.accent,
        variant: FlAvatarVariant.soft,
      ),
      name: 'Leah Doyle',
      detail: '[email protected]',
      tag: const FlChip(label: 'Pro plan', variant: FlChipVariant.soft, size: FlChipSize.sm),
      trailing: FlButton(label: 'Edit', size: FlButtonSize.sm, variant: FlButtonVariant.tertiary, onPressed: () {}),
    );
  }
}

Usage

The code the reference images render:

final example = ColoredBox(
  color: FlScope.of(context).colors.surface,
  child: Padding(
    padding: EdgeInsetsDirectional.all(FlScope.of(context).space.lg),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      spacing: FlScope.of(context).space.xl,
      children: [
        FlProfileCard(
          avatar: const FlAvatar(
            initials: "CM",
            semanticLabel: "Camille Martin",
            size: FlAvatarSize.lg,
          ),
          name: "Camille Martin",
          detail: "[email protected]",
          onPressed: () {},
        ),
        FlProfileCard(
          avatar: const FlAvatar(
            initials: "YB",
            semanticLabel: "Yasmine Benali",
            size: FlAvatarSize.lg,
            color: FlAvatarColor.success,
            variant: FlAvatarVariant.soft,
          ),
          name: "Yasmine Benali",
          detail: "@yasmine",
        ),
      ],
    ),
  ),
);

API

FlProfileCard: class extends StatelessWidget
FlProfileCard.new: const new({super.key, required Widget avatar, required String name, String? detail, Widget? tag, bool compact, VoidCallback? onPressed, Widget? trailing, FlSurfaceVariant variant})
FlProfileCard.avatar: get Widget
FlProfileCard.name: get String
FlProfileCard.detail: get String?
FlProfileCard.onPressed: get VoidCallback?
FlProfileCard.tag: get Widget?
FlProfileCard.compact: get bool
FlProfileCard.trailing: get Widget?
FlProfileCard.variant: get FlSurfaceVariant
FlProfileCard.build: Widget(BuildContext context)

Reference renders

The 16 images published with version 0.2.3, rendered by the shared harness on macOS with Flutter 3.47.7. fliin verify profile-card compares your copy to them.

iOS · Light
Account card, iOS, Light, text 1.0×, Left to right
Text 1.0× · Left to right
Account card, iOS, Light, text 1.0×, Right to left
Text 1.0× · Right to left
Account card, iOS, Light, text 2.0×, Left to right
Text 2.0× · Left to right
Account card, iOS, Light, text 2.0×, Right to left
Text 2.0× · Right to left
iOS · Dark
Account card, iOS, Dark, text 1.0×, Left to right
Text 1.0× · Left to right
Account card, iOS, Dark, text 1.0×, Right to left
Text 1.0× · Right to left
Account card, iOS, Dark, text 2.0×, Left to right
Text 2.0× · Left to right
Account card, iOS, Dark, text 2.0×, Right to left
Text 2.0× · Right to left
Android · Light
Account card, Android, Light, text 1.0×, Left to right
Text 1.0× · Left to right
Account card, Android, Light, text 1.0×, Right to left
Text 1.0× · Right to left
Account card, Android, Light, text 2.0×, Left to right
Text 2.0× · Left to right
Account card, Android, Light, text 2.0×, Right to left
Text 2.0× · Right to left
Android · Dark
Account card, Android, Dark, text 1.0×, Left to right
Text 1.0× · Left to right
Account card, Android, Dark, text 1.0×, Right to left
Text 1.0× · Right to left
Account card, Android, Dark, text 2.0×, Left to right
Text 2.0× · Left to right
Account card, Android, Dark, text 2.0×, Right to left
Text 2.0× · Right to left

Use it to

  • show the signed-in person above the account topics
  • open the account from the card at the top
  • show the name and email address of the signed-in user
  • navigate to account editing from the card
  • present the account holder first
Not for
  • a photo alone: use an avatar (avatar)
  • a list of people: use a list row (list-row)
States
  • Pressable
  • Static

Arrows to move, Enter to open, Escape to close.