Cody Weaver 95fbb31946
[Dialogs] Update README for new themer
Context
We recently added an API for a DialogThemer but we are yet to update the README.

The problem
We are missing docs for the new API

The fix
Update the readme to have the new themer API

Related issues
b/116306933
2018-10-03 15:13:15 -04:00

1.2 KiB

Theming

You can theme an MDCDialog to match the Material Design Dialog using your app's schemes in the DialogThemer extension.

You must first add the DialogThemer extension to your project:

pod 'MaterialComponents/Dialogs+DialogThemer'

You can then import the extension and create an MDCAlertControllerThemer instance. A dialog scheme defines the design parameters that you can use to theme your dialogs.

Swift

// Step 1: Import the DialogThemer extension
import MaterialComponents.MaterialDialogs_DialogThemer

// Step 2: Create or get a alert scheme
let alertScheme = MDCAlertScheme()

// Step 3: Apply the alert scheme to your component using the desired alert style
MDCAlertControllerThemer.applyScheme(scheme, to: alertController)

Objective-C

// Step 1: Import the DialogThemer extension
#import "MaterialDialogs+DialogThemer.h"

// Step 2: Create or get a alert scheme
MDCAlertScheme *alertScheme = [[MDCAlertScheme alloc] init];

// Step 3: Apply the alert scheme to your component using the desired alert style
[MDCAlertControllerThemer applyScheme:alertScheme toAlertController:alertController];