apptomate_custom_row 0.0.1 copy "apptomate_custom_row: ^0.0.1" to clipboard
apptomate_custom_row: ^0.0.1 copied to clipboard

A customizable Flutter Row widget with built-in spacing between children and additional layout options.

example/lib/main.dart

import 'package:apptomate_custom_row/apptomate_custom_row.dart';
import 'package:flutter/material.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
     debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const CustomRowWidget(),
    );
  }
}

/// Demo widget showcasing the [CustomRow] capabilities.
class CustomRowWidget extends StatelessWidget {
  const CustomRowWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Custom Row'),
        centerTitle: true,
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            _buildDemoRow(
              title: 'Default Spacing (8.0)',
              spacing: 8.0,
            ),
            const SizedBox(height: 24),
            _buildDemoRow(
              title: 'Increased Spacing (16.0)',
              spacing: 16.0,
            ),
            const SizedBox(height: 24),
            _buildDemoRow(
              title: 'With Outer Spacing',
              spacing: 12.0,
              includeOuterSpacing: true,
            ),
            const SizedBox(height: 24),
            _buildDemoRow(
              title: 'Space Between',
              spacing: 12.0,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
            ),
          ],
        ),
      ),
    );
  }

  Widget _buildDemoRow({
    required String title,
    double spacing = 8.0,
    bool includeOuterSpacing = false,
    MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
  }) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          title,
          style: const TextStyle(
            fontSize: 14,
            color: Colors.grey,
            fontWeight: FontWeight.bold,
          ),
        ),
        const SizedBox(height: 8),
        Container(
          padding: const EdgeInsets.all(12),
          decoration: BoxDecoration(
            border: Border.all(color: Colors.grey.shade300),
            borderRadius: BorderRadius.circular(8),
          ),
          child: CustomRow(
            spacing: spacing,
            includeOuterSpacing: includeOuterSpacing,
            mainAxisAlignment: mainAxisAlignment,
            children: [
              _buildDemoItem(icon: Icons.star, color: Colors.amber),
              _buildDemoItem(text: 'Custom', color: Colors.blue),
              _buildDemoItem(icon: Icons.check, color: Colors.green),
              _buildDemoItem(text: 'Row', color: Colors.purple),
            ],
          ),
        ),
      ],
    );
  }

  Widget _buildDemoItem({
    IconData? icon,
    String? text,
    required Color color,
  }) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
      decoration: BoxDecoration(
        color: color.withOpacity(0.2),
        borderRadius: BorderRadius.circular(4),
        border: Border.all(color: color),
      ),
      child: icon != null
          ? Icon(icon, color: color)
          : Text(text!, style: TextStyle(color: color)),
    );
  }
}
0
likes
160
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable Flutter Row widget with built-in spacing between children and additional layout options.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on apptomate_custom_row