vk_custom_widgets 1.0.1
vk_custom_widgets: ^1.0.1 copied to clipboard
A package containing most used custom widgets like - custom elevated buttons, password text form fields etc.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:vk_custom_widgets/vk_custom_widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Vk Custom Widgets Example',
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final TextEditingController _textController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
String? _selectedItem;
final List<String> _dropdownItems = ['Item 1', 'Item 2', 'Item 3'];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Vk Custom Widgets Example')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Buttons',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
VkElevatedButton(
label: 'Default Button',
onPressed: () {
debugPrint('Default Button Pressed');
},
),
const SizedBox(height: 10),
VkElevatedButton(
label: 'Custom Style Button',
backgroundColor: Colors.deepPurple,
borderRadius: 10,
onPressed: () {
debugPrint('Custom Button Pressed');
},
),
const SizedBox(height: 30),
const Text(
'Form Fields',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
VkTextFormField(
controller: _textController,
label: 'Text Field',
onChanged: (value) {
debugPrint('Text changed: $value');
},
),
const SizedBox(height: 10),
VkPasswordFormField(
controller: _passwordController,
label: 'Password Field',
),
const SizedBox(height: 30),
const Text(
'Dropdown',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
VkDropdown<String>(
items: _dropdownItems,
value: _selectedItem,
hint: 'Select an Item',
onChanged: (value) {
setState(() {
_selectedItem = value;
});
},
),
],
),
),
);
}
}