Commit cdf2779e authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

More docs for license screens (#6954)

parent 7c795d5f
...@@ -251,6 +251,14 @@ class LicenseEntryWithLineBreaks extends LicenseEntry { ...@@ -251,6 +251,14 @@ class LicenseEntryWithLineBreaks extends LicenseEntry {
/// The LICENSE files in each package can either consist of a single license, or /// The LICENSE files in each package can either consist of a single license, or
/// can be in the format described above. In the latter case, each component /// can be in the format described above. In the latter case, each component
/// license and list of package names is merged independently. /// license and list of package names is merged independently.
///
/// See also:
///
/// * [showAboutDialog], which shows a Material-style dialog with information
/// about the application, including a button that shows a [LicensePage] that
/// uses this API to select licenses to show.
/// * [AboutDrawerItem], which is a widget to put in a [Drawer] which
/// automatically calls [showAboutDialog].
class LicenseRegistry { class LicenseRegistry {
LicenseRegistry._(); LicenseRegistry._();
......
...@@ -27,11 +27,11 @@ import 'theme.dart'; ...@@ -27,11 +27,11 @@ import 'theme.dart';
/// version, icon, and copyright in the appropriate fields. /// version, icon, and copyright in the appropriate fields.
/// ///
/// The about box will include a button that shows licenses for software used by /// The about box will include a button that shows licenses for software used by
/// the application. /// the application. The licenses shown are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
/// ///
/// If your application does not have a [Drawer], you should provide an /// If your application does not have a [Drawer], you should provide an
/// affordance to call [showAboutDialog] or (at least) [showLicensePage]. /// affordance to call [showAboutDialog] or (at least) [showLicensePage].
// TODO(ianh): Mention the API for registering more licenses once it exists.
class AboutDrawerItem extends StatelessWidget { class AboutDrawerItem extends StatelessWidget {
/// Creates a drawer item for showing an about box. /// Creates a drawer item for showing an about box.
/// ///
...@@ -137,6 +137,9 @@ class AboutDrawerItem extends StatelessWidget { ...@@ -137,6 +137,9 @@ class AboutDrawerItem extends StatelessWidget {
/// ///
/// If you do not need an about box in your application, you should at least /// If you do not need an about box in your application, you should at least
/// provide an affordance to call [showLicensePage]. /// provide an affordance to call [showLicensePage].
///
/// The licenses shown on the [LicensePage] are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
void showAboutDialog({ void showAboutDialog({
@required BuildContext context, @required BuildContext context,
String applicationName, String applicationName,
...@@ -167,7 +170,9 @@ void showAboutDialog({ ...@@ -167,7 +170,9 @@ void showAboutDialog({
/// ///
/// The [AboutDialog] shown by [showAboutDialog] includes a button that calls /// The [AboutDialog] shown by [showAboutDialog] includes a button that calls
/// [showLicensePage]. /// [showLicensePage].
// TODO(ianh): Mention the API for registering more licenses once it exists. ///
/// The licenses shown on the [LicensePage] are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
void showLicensePage({ void showLicensePage({
@required BuildContext context, @required BuildContext context,
String applicationName, String applicationName,
...@@ -191,6 +196,15 @@ void showLicensePage({ ...@@ -191,6 +196,15 @@ void showLicensePage({
/// used by the application. /// used by the application.
/// ///
/// To show an [AboutDialog], use [showAboutDialog]. /// To show an [AboutDialog], use [showAboutDialog].
///
/// If the application has a [Drawer], the [AboutDrawerItem] widget can make the
/// process of showing an about dialog simpler.
///
/// The [AboutDialog] shown by [showAboutDialog] includes a button that calls
/// [showLicensePage].
///
/// The licenses shown on the [LicensePage] are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
class AboutDialog extends StatelessWidget { class AboutDialog extends StatelessWidget {
/// Creates an about box. /// Creates an about box.
/// ///
...@@ -304,14 +318,21 @@ class AboutDialog extends StatelessWidget { ...@@ -304,14 +318,21 @@ class AboutDialog extends StatelessWidget {
/// A page that shows licenses for software used by the application. /// A page that shows licenses for software used by the application.
/// ///
/// To show a [LicensePage], use [showLicensePage]. /// To show a [LicensePage], use [showLicensePage].
// TODO(ianh): Mention the API for registering more licenses once it exists. ///
/// The [AboutDialog] shown by [showAboutDialog] and [AboutDrawerItem] includes
/// a button that calls [showLicensePage].
///
/// The licenses shown on the [LicensePage] are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
class LicensePage extends StatefulWidget { class LicensePage extends StatefulWidget {
/// Creates a page that shows licenses for software used by the application. /// Creates a page that shows licenses for software used by the application.
/// ///
/// The arguments are all optional. The application name, if omitted, will be /// The arguments are all optional. The application name, if omitted, will be
/// derived from the nearest [Title] widget. The version and legalese values /// derived from the nearest [Title] widget. The version and legalese values
/// default to the empty string. /// default to the empty string.
// TODO(ianh): Mention the API for registering more licenses once it exists. ///
/// The licenses shown on the [LicensePage] are those returned by the
/// [LicenseRegistry] API, which can be used to add more licenses to the list.
const LicensePage({ const LicensePage({
Key key, Key key,
this.applicationName, this.applicationName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment