quickie
A package for doing it quickly. Requesting user input.
Hecho en 🇵🇷 por Radamés J. Valentín Reyes
Import
import 'package:quickie/quickie.dart';
Quickly get a String
String? result = await quickString(
title: const Text("Write something"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
Quickly get a int
int? result = await quickInt(
title: const Text("enter an int"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
Quickly get a double
double? result = await quickDouble(
title: const Text("enter an double"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
Quick Alert
Quickly display an alert message
await quickAlert(
context: context,
language: Languages.english,
alertMessage: TranslatableText(
options: [
TranslateOption(language: Languages.english, text: "Something happened: error code 45539"),
TranslateOption(language: Languages.spanish, text: "Algo sucedió: código de error 45539"),
],
displayLanguage: Languages.english,
),
overlayColor: Colors.green,
);
Quick Confirm
Quickly confirm action
GestureDetector(
onTap: ()async{
bool userChoice = await quickConfirm(
context: context,
content: const Text("Would you like to delete a file"),
language: Languages.english,
overlayColor: Colors.green,
);
print(userChoice);
},
child: const Text(
"Quick confirm",
),
),
Full Example
import 'package:flutter/material.dart';
import 'package:quickie/quickie.dart';
void main() {
runApp(const MaterialApp(
home: MyApp(),
));
}
class MyApp extends StatelessWidget {
const MyApp({ Key? key }) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
GestureDetector(
onTap: ()async{
String? result = await quickString(
title: const Text("Write something"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
},
child: const Text(
"String",
),
),
GestureDetector(
onTap: ()async{
int? result = await quickInt(
title: const Text("enter an int"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
},
child: const Text(
"int",
),
),
GestureDetector(
onTap: ()async{
double? result = await quickDouble(
title: const Text("enter an double"),
context: context,
inputFieldPadding: const EdgeInsets.all(10),
);
print("The result is $result");
},
child: const Text(
"double",
),
),
],
),
),
),
);
}
}