design 0.0.3 copy "design: ^0.0.3" to clipboard
design: ^0.0.3 copied to clipboard

Flutter App Design System

example/lib/main.dart

import 'package:design/app_input_field.dart';
import 'package:design/app_primary_button.dart';
import 'package:design/text_input_border.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.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(
      title: 'Design System Example',
      theme: ThemeData(
        colorScheme: const ColorScheme.light(
          primary: Color(0xFF0F82FF),
          error: Color(0xFFAB2D25),
        ),
      ),
      home: const MyHomePage(title: 'Design System Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final controller = TextEditingController();

  @override
  void initState() {
    super.initState();

    controller.text = 'Input text';
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              const Text('Inactive'),
              const SizedBox(height: 8),
              const AppInputField(
                decoration: InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Focused empty'),
              const SizedBox(height: 8),
              const AppInputField(
                decoration: InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                  prefixText: 'Prefix',
                  suffixText: 'Suffix'
                ),
                autofocus: true,
              ),
              const SizedBox(height: 16),
              const Text('Focused populated'),
              const SizedBox(height: 8),
              AppInputField(
                autofocus: true,
                controller: controller,
                decoration: const InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Activated'),
              const SizedBox(height: 8),
              AppInputField(
                controller: controller,
                decoration: const InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Disabled empty'),
              const SizedBox(height: 8),
              const AppInputField(
                enabled: false,
                decoration: InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Disabled populated'),
              const SizedBox(height: 8),
              AppInputField(
                controller: controller,
                enabled: false,
                decoration: const InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  helperText: 'Supporting text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Error empty'),
              const SizedBox(height: 8),
              const AppInputField(
                decoration: InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  errorText: 'Error text',
                ),
              ),
              const SizedBox(height: 16),
              const Text('Error populated'),
              const SizedBox(height: 8),
              const AppInputField(
                decoration: InputDecoration(
                  prefixIcon: Icon(Icons.lock),
                  suffixIcon: Icon(Icons.visibility),
                  labelText: 'Label',
                  errorText: 'Error text',
                ),
              ),
              const SizedBox(height: 16),
              const SizedBox(height: 12),
              AppPrimaryButton(
                "Primary - enabled",
                minimumSize: const Size(double.infinity, 48),
                backgroundColor: const Color(0xFF0B0020),
                disabledBackgroundColor: const Color(0xFFCFCED8),
                textStyle: const TextStyle(
                  fontSize: 16,
                  color: Color(0xFFFFFFFF),
                ),
                onPressed: () {
                  Fluttertoast.showToast(
                    msg: 'You pressed on "Primary - enabled',
                    toastLength: Toast.LENGTH_SHORT,
                    gravity: ToastGravity.CENTER,
                    timeInSecForIosWeb: 1,
                    backgroundColor: Colors.black,
                    textColor: Colors.white,
                    fontSize: 16,
                  );
                },
              ),
              const SizedBox(height: 12),
              AppPrimaryButton(
                "Primary - disabled",
                disabledBackgroundColor: Colors.blue.shade100,
                minimumSize: const Size(double.infinity, 48),
              ),
              const SizedBox(height: 24),
            ],
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }
}
2
likes
0
pub points
58%
popularity

Publisher

verified publisherlab.mobi

Flutter App Design System

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on design