watchface_config 1.0.0 copy "watchface_config: ^1.0.0" to clipboard
watchface_config: ^1.0.0 copied to clipboard

PlatformAndroid

Helps you make your Config Activity for WatchFaces in Flutter.

example/lib/main.dart

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:watchface_config/complication_receiver.dart';
import 'package:watchface_config/model/complication_type.dart';
import 'package:wearable_flutter_fragment_application/wearable_fragment_application_observers.dart';
import 'package:wearable_flutter_fragment_application/dismissible_container.dart';

import 'buttons.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Watchface config example',
        theme: ThemeData(),
        navigatorObservers: WearableFragmentApplication().observers,
        home: DismissibleContainer(child: ComplicationSelectorScreen()));
  }
}

class ComplicationSelectorScreen extends StatelessWidget {
  final List<List<ComplicationType>> supportedTypeList =
      List.generate(3, (index) => acceptableComplicationTypesByExample.toList());

  static const acceptableComplicationTypesByExample = [
    ComplicationType.shortText,
    ComplicationType.rangedValue,
    ComplicationType.icon,
    ComplicationType.smallImage,
    ComplicationType.largeImage
  ];

  ComplicationSelectorScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: ComplicationReceiver(
            supportedTypeList: supportedTypeList,
            builder: (context, complications) => SizedBox(
                  width: MediaQuery.of(context).size.width,
                  child: SingleChildScrollView(
                      child: Padding(
                          padding: const EdgeInsets.fromLTRB(12, 36, 12, 36),
                          child: Column(children: [
                            ...complications.mapIndexed((index, complication) =>
                                ComplicationButton(complication: complication, title: "Complication ${index + 1}")),
                          ]))),
                )));
  }
}
0
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Helps you make your Config Activity for WatchFaces in Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, flutter, plugin_platform_interface, wearable_flutter_fragment_application

More

Packages that depend on watchface_config