opt.
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const centerLoading = Center(child: CircularProgressIndicator());
|
||||
|
||||
const centerSizedLoading = SizedBox(
|
||||
width: 77,
|
||||
height: 77,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
|
||||
final loadingIcon = IconButton(onPressed: () {}, icon: centerLoading);
|
||||
@@ -1,38 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
Widget buildInput({
|
||||
TextEditingController? controller,
|
||||
int maxLines = 1,
|
||||
int? minLines,
|
||||
String? hint,
|
||||
String? label,
|
||||
Function(String)? onSubmitted,
|
||||
bool obscureText = false,
|
||||
IconData? icon,
|
||||
TextInputType? type,
|
||||
FocusNode? node,
|
||||
bool autoCorrect = true,
|
||||
}) {
|
||||
return RoundRectCard(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
child: TextField(
|
||||
maxLines: maxLines,
|
||||
minLines: minLines,
|
||||
onSubmitted: onSubmitted,
|
||||
keyboardType: type,
|
||||
focusNode: node,
|
||||
autocorrect: autoCorrect,
|
||||
decoration: InputDecoration(
|
||||
label: label != null ? Text(label) : null,
|
||||
hintText: hint,
|
||||
icon: icon != null ? Icon(icon) : null,
|
||||
border: InputBorder.none,
|
||||
import 'round_rect_card.dart';
|
||||
|
||||
class Input extends StatelessWidget {
|
||||
final TextEditingController? controller;
|
||||
final int maxLines;
|
||||
final int? minLines;
|
||||
final String? hint;
|
||||
final String? label;
|
||||
final Function(String)? onSubmitted;
|
||||
final bool obscureText;
|
||||
final IconData? icon;
|
||||
final TextInputType? type;
|
||||
final FocusNode? node;
|
||||
final bool autoCorrect;
|
||||
final bool suggestiion;
|
||||
|
||||
const Input({
|
||||
super.key,
|
||||
this.controller,
|
||||
this.maxLines = 1,
|
||||
this.minLines,
|
||||
this.hint,
|
||||
this.label,
|
||||
this.onSubmitted,
|
||||
this.obscureText = false,
|
||||
this.icon,
|
||||
this.type,
|
||||
this.node,
|
||||
this.autoCorrect = false,
|
||||
this.suggestiion = false,
|
||||
});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RoundRectCard(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
child: TextField(
|
||||
maxLines: maxLines,
|
||||
minLines: minLines,
|
||||
onSubmitted: onSubmitted,
|
||||
keyboardType: type,
|
||||
focusNode: node,
|
||||
autocorrect: autoCorrect,
|
||||
enableSuggestions: suggestiion,
|
||||
decoration: InputDecoration(
|
||||
label: label != null ? Text(label!) : null,
|
||||
hintText: hint,
|
||||
icon: icon != null ? Icon(icon) : null,
|
||||
border: InputBorder.none,
|
||||
),
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
),
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget buildPicker(
|
||||
List<Widget> items,
|
||||
Function(int idx) onSelected, {
|
||||
double height = 157,
|
||||
}) {
|
||||
final pad = (height - 37) / 2;
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: pad,
|
||||
bottom: pad,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 37,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||
color: Colors.black12,
|
||||
class Picker extends StatelessWidget {
|
||||
final List<Widget> items;
|
||||
final Function(int idx) onSelected;
|
||||
final double height;
|
||||
|
||||
const Picker({
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.onSelected,
|
||||
this.height = 157,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pad = (height - 37) / 2;
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: pad,
|
||||
bottom: pad,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 37,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListWheelScrollView.useDelegate(
|
||||
itemExtent: 37,
|
||||
diameterRatio: 2.7,
|
||||
controller: FixedExtentScrollController(initialItem: 0),
|
||||
onSelectedItemChanged: (idx) => onSelected(idx),
|
||||
physics: const FixedExtentScrollPhysics(),
|
||||
childDelegate: ListWheelChildBuilderDelegate(
|
||||
builder: (context, index) => Center(
|
||||
child: items[index],
|
||||
ListWheelScrollView.useDelegate(
|
||||
itemExtent: 37,
|
||||
diameterRatio: 2.7,
|
||||
controller: FixedExtentScrollController(initialItem: 0),
|
||||
onSelectedItemChanged: (idx) => onSelected(idx),
|
||||
physics: const FixedExtentScrollPhysics(),
|
||||
childDelegate: ListWheelChildBuilderDelegate(
|
||||
builder: (context, index) => Center(
|
||||
child: items[index],
|
||||
),
|
||||
childCount: items.length,
|
||||
),
|
||||
childCount: items.length,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user