Smashed the input bug!
This commit is contained in:
parent
a7830aec27
commit
8161b23755
@ -82,7 +82,7 @@ class CategoryRow extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 100),
|
||||
constraints: BoxConstraints(maxHeight: 100, maxWidth: 50),
|
||||
color: category.backgroundColor,
|
||||
child: SizedBox.expand(
|
||||
child: Center(
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'today_views/day_view.dart';
|
||||
import 'today_views/infinity_view.dart';
|
||||
import 'today_views/week_view.dart';
|
||||
|
||||
class TodayPage extends StatefulWidget {
|
||||
const TodayPage({Key? key}) : super(key: key);
|
||||
@ -57,7 +58,7 @@ class NarrowView extends StatelessWidget {
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
DayView(),
|
||||
Icon(Icons.directions_transit, size: 350),
|
||||
WeekView(),
|
||||
Icon(Icons.directions_car, size: 350),
|
||||
InfinityView(),
|
||||
],
|
||||
|
||||
@ -487,7 +487,7 @@ class HourFormField extends StatefulWidget {
|
||||
required this.dayEntry,
|
||||
});
|
||||
|
||||
final Category? category;
|
||||
Category? category;
|
||||
int index;
|
||||
Document dayEntry;
|
||||
|
||||
@ -511,11 +511,6 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
TextSelection(baseOffset: 0, extentOffset: _controller.text.length);
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.category != null) {
|
||||
catNum = widget.category!.number.toString();
|
||||
fgColor = widget.category!.foregroundColor;
|
||||
@ -528,6 +523,11 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
),
|
||||
);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
@ -536,15 +536,33 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
SizedBox(
|
||||
width: 50,
|
||||
child: Consumer<DatabaseAPI>(builder: (context, database, child) {
|
||||
// return TextField(
|
||||
// controller: _controller,
|
||||
// focusNode: _node,
|
||||
// onEditingComplete: () async {
|
||||
// String value = _controller.value.text;
|
||||
// database.updateHours(widget.dayEntry, widget.index, value);
|
||||
|
||||
// _node.nextFocus();
|
||||
// },
|
||||
// keyboardType: TextInputType.number,
|
||||
// textAlign: TextAlign.center,
|
||||
// );
|
||||
return Consumer<CategoriesAPI>(
|
||||
builder: (context, categories, child) {
|
||||
return TextFormField(
|
||||
showCursor: false,
|
||||
autofillHints: [],
|
||||
key: Key(
|
||||
"hourField-${widget.dayEntry.$id}-${widget.index.toString()}"),
|
||||
onTap: () {},
|
||||
textInputAction: TextInputAction.next,
|
||||
onEditingComplete: () {
|
||||
String value = _controller.value.text;
|
||||
database.updateHours(widget.dayEntry, widget.index, value);
|
||||
setState(() {
|
||||
widget.category = categories.lookUp(num.parse(value));
|
||||
catName = widget.category!.name;
|
||||
});
|
||||
_node.nextFocus();
|
||||
},
|
||||
style: TextStyle(
|
||||
@ -556,6 +574,7 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
controller: _controller,
|
||||
focusNode: _node,
|
||||
);
|
||||
});
|
||||
}),
|
||||
),
|
||||
SizedBox(width: 40),
|
||||
|
||||
30
ltx_flutter/lib/pages/today_views/week_view.dart
Normal file
30
ltx_flutter/lib/pages/today_views/week_view.dart
Normal file
@ -0,0 +1,30 @@
|
||||
import 'package:ltx_flutter/appwrite/categories_api.dart';
|
||||
import 'package:ltx_flutter/appwrite/database_api.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:appwrite/models.dart';
|
||||
import 'package:ltx_flutter/helpers.dart';
|
||||
|
||||
class WeekView extends StatelessWidget {
|
||||
const WeekView({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
showCursor: false,
|
||||
autofillHints: [],
|
||||
autocorrect: false,
|
||||
onEditingComplete: () {
|
||||
print("Test");
|
||||
},
|
||||
style:
|
||||
TextStyle(color: Colors.amber, fontFamily: "Monospace", height: 35),
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user