hasnain_ui_button 0.0.2
hasnain_ui_button: ^0.0.2 copied to clipboard
A customizable button widget package for Flutter applications
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:hasnain_ui_button/hasnain_ui_button.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) {
final colorScheme = Theme.of(context).colorScheme;
return MaterialApp(
title: 'hasnain ui button',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: Scaffold(
appBar: AppBar(
title: const Text('hasnain ui button'),
),
body: SingleChildScrollView(
child: Center(
child: Column(
children: [
Button(
variant: ButtonVariant.outline,
text: 'Click me',
onPressed: () {
print('Button pressed');
},
),
const SizedBox(height: 10),
Button(
text: 'solid',
onPressed: () {},
variant: ButtonVariant.solid),
const SizedBox(height: 10),
Button(
text: 'solid2',
backgroundColor: Colors.redAccent,
onPressed: () {},
variant: ButtonVariant.solid,
textStyle: const TextStyle(color: Colors.green),
),
const SizedBox(height: 10),
Button(
width: 140,
text: 'custom outline',
onPressed: () {},
variant: ButtonVariant.outline,
borderSide: const BorderSide(color: Colors.red, width: 2),
),
const SizedBox(height: 10),
Button(
text: 'destructive',
onPressed: () {},
variant: ButtonVariant.destructive,
),
const SizedBox(height: 10),
Button(
text: 'radius',
onPressed: () {},
variant: ButtonVariant.solid,
backgroundColor: Colors.teal,
borderRadius: BorderRadius.circular(40),
),
const SizedBox(height: 10),
Button(
text: 'testStyle',
onPressed: () {},
variant: ButtonVariant.solid,
backgroundColor: Colors.teal,
borderRadius: BorderRadius.circular(40),
textStyle: const TextStyle(
color: Colors.redAccent,
fontWeight: FontWeight.bold,
fontSize: 18),
),
const SizedBox(height: 10),
Button(
text: 'height-width',
onPressed: () {},
backgroundColor: Colors.green,
height: 40,
width: 100,
),
const SizedBox(height: 10),
Button(
text: 'disabled',
onPressed: () {
print('Button pressed');
},
backgroundColor: Colors.red,
height: 40,
width: 100,
isDisabled: true,
),
const SizedBox(height: 10),
Button(
text: 'primary',
onPressed: () {},
backgroundColor: colorScheme.primary,
height: 40,
width: 100,
),
const SizedBox(height: 10),
Button(
text: 'second',
onPressed: () {},
backgroundColor: colorScheme.secondary,
height: 40,
width: 100,
),
],
),
),
)),
);
}
}