Skip to main content

responsive_config 0.1.7 copy "responsive_config: ^0.1.7" to clipboard
responsive_config: ^0.1.7 copied to clipboard

discontinued
outdated

Code generation package, that allows generating responsive classes and responsive variables with annotations.

example/example.dart

import 'package:flutter/material.dart';

import 'package:responsive_annotation/responsive_annotation.dart';

part 'example.g.dart';

@ResponsiveConfig(tabletBreakpoint: 700)
abstract class AppConfig {
  const AppConfig({
    required this.margin,
    required this.title,
    required this.customSample,
  });

  factory AppConfig.of(BuildContext context) =>
      _$ResponsiveAppConfig.of(context);

  @ResponsiveVariable<double>(
    mobile: 16,
    tablet: 32,
    laptop: 48,
    desktop: 64,
    widescreen: 128,
  )
  final double margin;

  @ResponsiveVariable<String>(
    mobile: 'Mobile',
    tablet: 'Tablet',
    laptop: 'Laptop',
    desktop: 'Desktop',
    widescreen: 'Widescreen',
  )
  final String title;

  @ResponsiveVariable<CustomClass>(
    mobile: CustomClassMobile(),
    tablet: CustomClass(),
    laptop: CustomClassLaptop(),
    desktop: CustomClass(),
    widescreen: CustomClassWidescreen(),
  )
  final CustomClass customSample;

  // No code will be generated for static or non final variables.
  @ResponsiveVariable()
  static const double commonSpacing = 24;
}

class CustomClass {
  const CustomClass();
}

class CustomClassMobile extends CustomClass {
  const CustomClassMobile();
}

class CustomClassLaptop extends CustomClass {
  const CustomClassLaptop();
}

class CustomClassWidescreen extends CustomClass {
  const CustomClassWidescreen();
}
3
likes
0
points
18
downloads

Publisher

verified publishereterkit.com

Weekly Downloads

Code generation package, that allows generating responsive classes and responsive variables with annotations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, flutter, responsive_annotation, source_gen

More

Packages that depend on responsive_config