Skip to content
Ivan Galkin edited this page Jan 1, 2024 · 4 revisions

1) Fill entities

Create and fill the presentational entities you need from the interfaces that this package provides:

class Animations extends FPCDefaultAnimation {
  const Animations();
  // Override properties
}

class TimesOfDay extends FPCDefaultTimeOfDay {
  const TimesOfDay();
  // Override properties
}

class DateTimes extends FPCDefaultDateTime {
  DateTimes();
  // Override properties
}

class Durations extends FPCDefaultDuration {
  const Durations();
  // Override properties
}

class Haptics extends FPCDefaultHaptic {
  const Haptics();
  // Override properties
}

class LightTheme extends FPCDefaultLightTheme {
  const LightTheme();
  // Override properties
}

class Sizes extends FPCDefaultSize {
  const Sizes();
  // Override properties
}

class Fonts extends FPCDefaultFont {
  const Fonts();
  // Override properties
}

2) Initialize root widget

Initialize the main component widget at the root:

void main() => runApp(
      FlutterPlatformComponent( // Initialize the main widget at the root
        animation: const Animations(),
        timeOfDay: const TimesOfDay(),
        dateTime: DateTimes(),
        duration: const Durations(),
        platform: FPCPlatform.iOS,
        haptic: const Haptics(),
        theme: LightTheme(),
        size: const Sizes(),
        font: const Fonts(),
        child: const Application(),
      ),
    );

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

  @override
  Widget build(BuildContext context,) {
    return FPCApp(
      home: const HomeScreen(),
    );
  }
}

3) Use components

All basic components are named "FPC{component-name}".
Usage basic components:

FPCButton(
  backgroundColor: theme.primary,
  splashColor: theme.whiteAlways,
  borderRadius: BorderRadius.circular(16),
  child: Text("Next"),
  onPressed: _next,
),

All ready-made components are named "FPC{color}{component-name}".
Usage ready-made components:

FPCPrimaryButton(
  title: "Next", 
  onPressed: _next,
),
Clone this wiki locally