DEV Community

Cover image for StyleBook: formula notes, Arabic RTL and ads that wait their turn
Stacklyn Labs
Stacklyn Labs

Posted on

StyleBook: formula notes, Arabic RTL and ads that wait their turn

Six weeks after a colour appointment, the client is back in the chair and asks for "the same as last time". The stylist needs the exact mix, the developer strength and how long it sat. If that lives on a sticky note, good luck.

StyleBook is our Flutter template for barbershops, hair salons, nail studios, spas and freelance stylists. It's a client CRM, an appointment book and an income and expense tracker, all stored on the device in Hive CE. There's no backend and no internet requirement, so a dead Wi-Fi connection at the front desk doesn't stop the day's bookings.

We made a lot of small calls building it. Three were bigger than the rest.

Notes belong to the visit, not the client

Our first instinct was a notes field on the client. It's wrong for colour work. A formula changes from visit to visit, and the useful question is "what did we do on 3 March", not "what's this person's formula".

So every appointment carries its own free-text formula and technical notes, plus a photo of the result. The client screen then reads as a history: each visit, its services, its notes, its photo.

// simplified
enum AppointmentStatus { pending, completed, cancelled }

class Appointment extends HiveObject {
  Appointment({
    required this.clientId,
    required this.services,
    required this.start,
    required this.totalCost,
    this.status = AppointmentStatus.pending,
    this.formulaNotes,
    this.photoPath,
  });

  final String clientId;
  final List<String> services; // Haircut, Coloring, Highlights...
  final DateTime start;
  final double totalCost;
  AppointmentStatus status;
  String? formulaNotes;
  String? photoPath;
}
Enter fullscreen mode Exit fullscreen mode

The status field matters more than it looks. An earlier version counted pending and cancelled visits as income, which made the Insights tab look great and meant nothing. Now only Completed appointments count:

// simplified
double incomeFor(Iterable<Appointment> visits) => visits
    .where((a) => a.status == AppointmentStatus.completed)
    .fold(0, (sum, a) => sum + a.totalCost);
Enter fullscreen mode Exit fullscreen mode

Photos had their own lesson. They used to be kept in a temporary folder, and some were lost. Photos from the camera or gallery are now stored in the app folder, and a ZIP backup carries every client and appointment photo along with the data.

StyleBook appointment screen with service chips, status, cost and formula notes

Ads, but on a short lead

StyleBook ships with AdMob interstitials. We went back and forth on this. A receptionist booking a walk-in doesn't want a full-screen ad in the way, and an earlier build did show interstitials on tab switches. That was a bug, and we treated it like one.

The rules now:

  • An ad can only appear after a record is saved, never mid-task.
  • At most 3 per session.
  • At least 2 minutes between ads.
  • Google's UMP consent form runs first, with an Ad Privacy Options entry.
  • One constant turns ads off completely.
// simplified
class AdGate {
  static const adsEnabled = true; // set false to ship without ads
  static const maxPerSession = 3;
  static const minGap = Duration(minutes: 2);

  int _shown = 0;
  DateTime? _last;

  bool canShowAfterSave(DateTime now) {
    if (!adsEnabled || _shown >= maxPerSession) return false;
    if (_last != null && now.difference(_last!) < minGap) return false;
    return true;
  }

  void markShown(DateTime now) {
    _shown++;
    _last = now;
  }
}
Enter fullscreen mode Exit fullscreen mode

Saving a record is a natural pause. The person just finished something. That's the only place we felt an ad was fair.

Right to left, all the way to the PDF

StyleBook speaks English, Spanish, Arabic and Hindi, picked in Settings, with ARB files for the strings. Arabic flips the whole layout right to left, and dates, month names and money follow the selected language.

Flipping the screens was the easy half. The hard half was everything that isn't a widget. PDF client reports didn't handle Arabic and Hindi text until we embedded Noto fonts in them. Amount fields didn't handle "12,50" or Arabic digits either. That second one needed a small normaliser before parsing:

// simplified
String normalizeDigits(String input) {
  const arabicIndic = '٠١٢٣٤٥٦٧٨٩';
  final out = StringBuffer();
  for (final ch in input.split('')) {
    final i = arabicIndic.indexOf(ch);
    out.write(i >= 0 ? '$i' : ch);
  }
  return out.toString().replaceAll(',', '.');
}
Enter fullscreen mode Exit fullscreen mode

It's dull code, and it decides whether a salon in Riyadh can type a price at all.

StyleBook in Arabic right-to-left layout and dark mode

The limits, plainly

Everything lives on one device, and there's no backend, so clients can't book themselves online and a second stylist's phone won't see the same calendar. The project ships with Google's test ad IDs, so you need your own AdMob IDs before release, or you flip the constant and ship without ads. The web build is a UI preview only, without reminders, ads or photo storage. Reminders are local notifications, 1 hour before each pending appointment.

Try it

It's Flutter 3.44 and Dart 3.12 with Provider and Hive CE, and the Regular licence is $29.

Do you put ads in business tools at all? And if you do, where's the least annoying place you've found for them?

Top comments (0)