x_containers 1.2.6 copy "x_containers: ^1.2.6" to clipboard
x_containers: ^1.2.6 copied to clipboard

A Flutter package offering more adaptive and easy-to-use container widgets.

example/lib/main.dart

import "package:flutter/material.dart";
import "package:get/get.dart";
import "package:x_containers/x_containers.dart";

import "globals.dart";
import "widgets/widgets.dart";

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Setting the global theme shared across XContainers.
  xTheme.set(
    padding: EdgeInsets.all(XLayout.paddingS),
    paddingValue: XLayout.paddingM,
  );

  runApp(const ExampleApp());
}

/// A mock app to demonstrate how to use the XContainers.
class ExampleApp extends StatelessWidget {
  /// Returns a [ExampleApp] matching the given parameters.
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: const Home(),
      theme: lightTheme,
      darkTheme: darkTheme,
      themeMode: ThemeMode.dark,
    );
  }
}

/// A simple tab listing a few XContainers.
class Home extends StatelessWidget {
  // CONSTRUCTOR ===============================================================

  /// Returns an instance of [Home] matching the given parameters.
  const Home({super.key});

  // BUILD =====================================================================

  @override
  Widget build(BuildContext context) {
    const List<Widget> examples = [
      ExampleContainer(),
      ExampleXContainer(),
      ExampleXInkContainer(),
      ExampleXCard(),
      ExampleXDialog(),
      ExampleXSnackbar(),
    ];

    return Scaffold(
      appBar: AppBar(
        title: const Text("XContainer: Examples"),
      ),
      body: ListView.separated(
        padding: EdgeInsets.all(XLayout.paddingM),
        shrinkWrap: true,
        itemCount: examples.length,
        itemBuilder: (_, index) => Center(
          child: examples[index],
        ),
        separatorBuilder: (_, __) => XLayout.verticalS,
      ),
    );
  }
}
1
likes
150
points
58
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package offering more adaptive and easy-to-use container widgets.

Repository (GitHub)

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter

More

Packages that depend on x_containers