ikki_ui_widgets 0.0.5
ikki_ui_widgets: ^0.0.5 copied to clipboard
A flutter ui library for Ikki
example/lib/main.dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ikki_ui_widgets/ikki_ui_widgets.dart';
import 'package:ikki_ui_widgets/text_field/ikki_date_picker.dart';
import 'package:date_format/date_format.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter ikki',
theme: ThemeData(primarySwatch: Colors.indigo //teal,
),
home: const MyHomePage(title: 'Flutter ikki'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String state = "Chihuahua";
final _emailController = TextEditingController();
final FocusNode myFocusNode = FocusNode();
late DateTime _currentDate;
final GlobalKey<FormState> _key = GlobalKey<FormState>();
final TextEditingController _password2Controller = TextEditingController();
final TextEditingController _controllerDate = TextEditingController();
@override
void initState() {
_currentDate = DateTime.now();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView(children: [
Form(
key: _key,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
IkkiButton(
icon: const Icon(Icons.ac_unit),
text: "IkkiButton",
onPressed: () {
IkkiModalBottom(
context,
IkkiButtonOutline(
text: "IkkiButtonOutline",
onPressed: () {},
),
);
},
),
const SizedBox(height: 10.0),
IkkiButtonOutline(
text: "IkkiButtonOutline",
onPressed: () {},
),
const SizedBox(height: 10.0),
IkkiTextButton(
text: "IkkiTextButton",
onPressed: () {},
),
const SizedBox(height: 10.0),
const IkkiBanner(
color: Colors.red,
iconLeft: Icon(Icons.check_circle_outlined),
iconRight: Icon(Icons.close_sharp),
text: "baner",
),
const SizedBox(height: 10.0),
IkkiTextField(
primaryColor: Colors.amberAccent,
textTitle: "titulo",
onChanged: (p0) => print(p0),
onNext: () {},
iconLeft: const Icon(Icons.account_circle),
iconRight: const Icon(Icons.add_circle_outline),
onValidator: (value) {
return "false";
},
textHint: "correo@ejemplo.com",
),
const SizedBox(height: 10.0),
IkkiTextField(
controller: _password2Controller,
onValidator: (s) {
if (s!.isEmpty) {
return 'dsads';
}
return null;
},
textHint: "correo@ejemplo.com",
),
const SizedBox(height: 10.0),
IkkiTitle(
iconLeft: const Icon(Icons.arrow_back_rounded),
onPressedLeft: () => _key.currentState!.validate(),
text: "IkkiSubTitle",
fontSize: 18,
color: Colors.black,
),
Row(
children: [
IkkiButtonIcon(
onPressed: () {
print("IkkiButtonIcon");
},
icon: const Icon(Icons.arrow_forward)),
const SizedBox(width: 100.0),
IkkiTextLink(
onPressed: () {
print("IkkiTextLink");
},
textLink: "aqui",
textLeft: "de click"),
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: IkkiDatePicker(
controller: _controllerDate,
onPressIcon: () => _showDialogDate((date) {
_currentDate = date;
_controllerDate.text =
formatDate(date, [dd, "-", mm, "-", yyyy]);
}),
),
)
],
),
),
]),
);
}
Future<dynamic> _showDialogDate(Function(DateTime) callback) {
return showModalBottomSheet(
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15.0),
topRight: Radius.circular(15.0),
),
),
isDismissible: true,
useRootNavigator: true,
context: context,
builder: (context) {
return WillPopScope(
onWillPop: (() async {
callback;
Navigator.pop(context);
return true;
}),
child: SafeArea(
top: false,
child: SizedBox(
height: 315,
child: Column(
children: [
const SizedBox(
height: 15,
width: 1,
),
Container(
height: 300,
color: Colors.transparent,
child: CupertinoApp(
theme: const CupertinoThemeData(
brightness: Brightness.light),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: CupertinoDatePicker(
initialDateTime: _currentDate,
mode: CupertinoDatePickerMode.date,
use24hFormat: true,
dateOrder: DatePickerDateOrder.dmy,
backgroundColor: const Color(0xFFFaFaFa),
onDateTimeChanged: callback),
),
),
),
],
),
),
),
);
},
);
}
}