leo_easy_ui_kit 0.1.0
leo_easy_ui_kit: ^0.1.0 copied to clipboard
Leo Easy UI Kit: effortless yet powerful Flutter UI components.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:leo_easy_ui_kit/leo_easy_ui_kit.dart';
void main() {
runApp(const LeoEasyUiExampleApp());
}
class LeoEasyUiExampleApp extends StatelessWidget {
const LeoEasyUiExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Leo Easy UI Kit Demo',
theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.blue),
home: const ExampleHomePage(),
);
}
}
class ExampleHomePage extends StatefulWidget {
const ExampleHomePage({super.key});
@override
State<ExampleHomePage> createState() => _ExampleHomePageState();
}
class _ExampleHomePageState extends State<ExampleHomePage> {
final roles = const ['Student', 'Teacher', 'Admin'];
String? role = 'Student';
final interests = const ['Math', 'Science', 'English', 'Programming'];
List<String> selectedInterests = const [];
String? level = 'Beginner';
int? age = 18;
final searchController = SearchRecommendationController<String>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Leo Easy UI Kit example')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Dropdown', style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
easyDropdownOf<String>(
items: roles,
value: role,
onChanged: (value) => setState(() => role = value),
),
const SizedBox(height: 24),
Text('Checkbox (multi-select)',
style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
easyCheckboxOf<String>(
items: interests,
values: selectedInterests,
onChangedMany: (values) =>
setState(() => selectedInterests = values),
multiSelect: true,
),
const SizedBox(height: 24),
Text('Button group',
style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
easyButtonGroupOf<String>(
items: const ['Beginner', 'Intermediate', 'Advanced'],
value: level,
onChanged: (value) => setState(() => level = value),
),
const SizedBox(height: 24),
Text('Text field',
style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
easyTextFieldOf<int>(
value: age,
onChanged: (value) => setState(() => age = value),
hintText: 'Age',
keyboardType: TextInputType.number,
parser: (text) => int.tryParse(text),
),
const SizedBox(height: 24),
Text('Search', style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
easySearchOf<String>(
items: const ['Alice', 'Bob', 'Charlie', 'Dave', 'Eve'],
label: (v) => v,
onSelected: (value) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Selected: $value')),
);
},
),
],
),
),
);
}
}