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

outdated

sample button style

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:art_buttons_kh/art_buttons_kh.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: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const LoginView(),
    );
  }
}



class LoginView extends StatefulWidget {
  const LoginView({Key? key}) : super(key: key);

  @override
  _LoginViewState createState() => _LoginViewState();
}

class _LoginViewState extends State<LoginView> {
  final _formKey = GlobalKey<FormState>();

  String _email = '';
  String _password = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Login'),
      ),
      body: Padding(
        padding: EdgeInsets.all(16),
        child: Form(
          key: _formKey,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              TextFormField(
                decoration: InputDecoration(labelText: 'Email'),
                keyboardType: TextInputType.emailAddress,
                validator: (value) {
                  if (value == null || value.isEmpty) {
                    return 'Please enter your email';
                  }
                  return null;
                },
                onSaved: (value) {
                  _email = value!;
                },
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(labelText: 'Password'),
                obscureText: true,
                validator: (value) {
                  if (value == null || value.isEmpty) {
                    return 'Please enter your password';
                  }
                  return null;
                },
                onSaved: (value) {
                  _password = value!;
                },
              ),
              SizedBox(height: 32),
              ArtButtonsKh(
                onPressed: _submitForm,
                text: 'Login',
                backgroundColor: Theme.of(context).primaryColor,
              ),

              ArtButtonsKh(
                margin: const EdgeInsets.only(top: 10),
                onPressed: _submitForm,
                text: 'Save',
                backgroundColor: Colors.amber,
              ),
              ArtButtonsKh(
                margin: const EdgeInsets.only(top: 10),
                onPressed: _submitForm,
                text: 'Closed',
                backgroundColor: Colors.redAccent,
              ),
              ArtButtonsKh(
                margin: const EdgeInsets.only(top: 10),
                onPressed: _submitForm,
                text: 'Disabled',
                backgroundColor: Colors.brown,

              ),
            ],
          ),
        ),
      ),
    );
  }

  void _submitForm() {
    if (_formKey.currentState!.validate()) {
      _formKey.currentState!.save();
      // TODO: Implement login functionality
    }
  }
}
1
likes
0
points
759
downloads

Publisher

verified publisherkimsoer.site

Weekly Downloads

sample button style

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on art_buttons_kh