wx_chip 1.0.2 copy "wx_chip: ^1.0.2" to clipboard
wx_chip: ^1.0.2 copied to clipboard

Restructure the Flutter Chips to allow for simpler styling and theming, ensuring it's not limited to specific platforms.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:theme_patrol/theme_patrol.dart';
import 'package:wx_chip/wx_chip.dart';
import 'package:wx_text/wx_text.dart';
import 'theme_picker.dart';
import 'sample_appearance.dart';
import 'sample_appearance_mix.dart';
import 'sample_disabled.dart';
import 'sample_severity.dart';
import 'sample_compound.dart';
import 'sample_driven.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return ThemePatrol(
      themes: {
        'm2': ThemeConfig.withMode(
          description: 'Material 2',
          light: ThemeData.light(useMaterial3: false),
          dark: ThemeData.dark(useMaterial3: false),
          extensionsBuilder: [
            (context) => WxChipThemeM2(context),
          ],
        ),
        'm3': ThemeConfig.withMode(
          description: 'Material 3',
          light: ThemeData.light(useMaterial3: true),
          dark: ThemeData.dark(useMaterial3: true),
          extensionsBuilder: [
            (context) => WxChipThemeM3(context),
          ],
        ),
        'ios': ThemeConfig.withMode(
          description: 'IOS',
          light: ThemeData.light(useMaterial3: false),
          dark: ThemeData.dark(useMaterial3: false),
          extensionsBuilder: [
            (context) => WxChipThemeIOS(context),
          ],
        ),
      },
      initialTheme: 'm2',
      builder: (context, theme, child) {
        return MaterialApp(
          title: 'WxChip Demo',
          theme: theme.lightData,
          darkTheme: theme.darkData,
          themeMode: theme.mode,
          home: const MyHomePage(),
          builder: theme.bootstrap(),
        );
      },
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: SingleChildScrollView(
        child: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(height: 40),
              WxText.displayMedium(
                'WxChip',
                gradient: LinearGradient(
                  colors: [
                    Colors.green,
                    Colors.blue,
                  ],
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                ),
                fontWeight: FontWeight.bold,
                letterSpacing: -2,
              ),
              SizedBox(height: 10),
              ThemePicker(),
              SizedBox(height: 40),
              SampleAppearance(),
              SizedBox(height: 20),
              SampleAppearanceMix(),
              SizedBox(height: 20),
              SampleDisabled(),
              SizedBox(height: 20),
              SampleSeverity(),
              SizedBox(height: 20),
              SampleCompound(),
              SizedBox(height: 20),
              SampleDriven(),
              SizedBox(height: 40),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
160
points
20
downloads

Publisher

verified publisherwidgetarian.com

Weekly Downloads

Restructure the Flutter Chips to allow for simpler styling and theming, ensuring it's not limited to specific platforms.

Repository (GitHub)
View/report issues

Topics

#ui #chip #event-driven #widgetarian

Documentation

API reference

Funding

Consider supporting this project:

buymeacoffee.com
ko-fi.com

License

BSD-3-Clause (license)

Dependencies

flutter, wx_sheet

More

Packages that depend on wx_chip