Skip to content

Latest commit

 

History

History
169 lines (141 loc) · 4.8 KB

File metadata and controls

169 lines (141 loc) · 4.8 KB
banner-flutter-preferences

Courier Preferences

Allow users to update which types of notifications they would like to receive.

Requirements

Requirement Reason
Authentication Needed to view preferences that belong to a user.

Default Preferences View

The default CourierPreferences styles.

default-preference-styles
import 'package:courier_flutter/ui/preferences/courier_preferences.dart';

...

@override
Widget build(BuildContext context) {
  return CourierPreferences(
    mode: TopicMode(),
  );
}

Styled Preferences View

The styles you can use to quickly customize the CourierPreferences.

default-inbox-styles
import 'package:courier_flutter/courier_preference_channel.dart';
import 'package:courier_flutter/ui/inbox/courier_inbox_theme.dart';
import 'package:courier_flutter/ui/preferences/courier_preferences_theme.dart';
import 'package:courier_flutter/ui/preferences/courier_preferences.dart';

...

final customTheme = CourierPreferencesTheme(
  brandId: "YOUR_BRAND_ID",
  topicSeparator: null,
  sectionTitleStyle: GoogleFonts.sen().copyWith(
    fontWeight: FontWeight.bold,
    fontSize: 20,
    color: Color(0xFF9747FF),
  ),
  topicTitleStyle: GoogleFonts.sen().copyWith(
    fontWeight: FontWeight.normal,
    fontSize: 18,
  ),
  topicSubtitleStyle: GoogleFonts.sen().copyWith(
    fontWeight: FontWeight.normal,
    fontSize: 16,
  ),
  topicTrailing: const Icon(
    Icons.edit_outlined,
    color: Colors.black45,
  ),
  sheetSeparator: null,
  sheetTitleStyle: GoogleFonts.sen().copyWith(
    fontWeight: FontWeight.bold,
    fontSize: 20,
    color: Color(0xFF9747FF),
  ),
  sheetSettingStyles: SheetSettingStyles(
    textStyle: GoogleFonts.sen().copyWith(
      fontWeight: FontWeight.normal,
      fontSize: 18,
    ),
    activeTrackColor: Color(0xFF9747FF),
    activeThumbColor: Colors.white,
    inactiveTrackColor: Colors.black45,
    inactiveThumbColor: Colors.white,
  ),
  sheetShape: RoundedRectangleBorder(
    borderRadius: BorderRadius.vertical(
      top: Radius.circular(16.0),
    ),
  ),
  infoViewStyle: CourierInfoViewStyle(
    textStyle: GoogleFonts.sen().copyWith(
      fontWeight: FontWeight.bold,
      fontSize: 16,
    ),
    buttonStyle: FilledButton.styleFrom(
      backgroundColor: Colors.grey,
      foregroundColor: Colors.white,
      textStyle: GoogleFonts.sen().copyWith(
        fontWeight: FontWeight.normal,
        fontSize: 16,
      ),
    ),
  ),
);

...

@override
Widget build(BuildContext context) {
  return CourierPreferences(
    // keepAlive: true, // Useful if you are adding this widget to a TabBarView
    lightTheme: customTheme,
    darkTheme: customTheme,
    mode: ChannelsMode(channels: [CourierUserPreferencesChannel.push, CourierUserPreferencesChannel.sms, CourierUserPreferencesChannel.email]),
    onError: (error) => print(error),
  );
}

Courier Studio Branding (Optional)

setting

You can control your branding from the Courier Studio.

Supported Brand Styles Support
Primary Color
Show/Hide Courier Footer

👋 Branding APIs can be found here

👋 Preference APIs can be found here