Smashed the input bug!
This commit is contained in:
parent
a7830aec27
commit
8161b23755
@ -82,7 +82,7 @@ class CategoryRow extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
constraints: BoxConstraints(maxHeight: 100),
|
constraints: BoxConstraints(maxHeight: 100, maxWidth: 50),
|
||||||
color: category.backgroundColor,
|
color: category.backgroundColor,
|
||||||
child: SizedBox.expand(
|
child: SizedBox.expand(
|
||||||
child: Center(
|
child: Center(
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'today_views/day_view.dart';
|
import 'today_views/day_view.dart';
|
||||||
import 'today_views/infinity_view.dart';
|
import 'today_views/infinity_view.dart';
|
||||||
|
import 'today_views/week_view.dart';
|
||||||
|
|
||||||
class TodayPage extends StatefulWidget {
|
class TodayPage extends StatefulWidget {
|
||||||
const TodayPage({Key? key}) : super(key: key);
|
const TodayPage({Key? key}) : super(key: key);
|
||||||
@ -57,7 +58,7 @@ class NarrowView extends StatelessWidget {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
DayView(),
|
DayView(),
|
||||||
Icon(Icons.directions_transit, size: 350),
|
WeekView(),
|
||||||
Icon(Icons.directions_car, size: 350),
|
Icon(Icons.directions_car, size: 350),
|
||||||
InfinityView(),
|
InfinityView(),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -487,7 +487,7 @@ class HourFormField extends StatefulWidget {
|
|||||||
required this.dayEntry,
|
required this.dayEntry,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Category? category;
|
Category? category;
|
||||||
int index;
|
int index;
|
||||||
Document dayEntry;
|
Document dayEntry;
|
||||||
|
|
||||||
@ -511,11 +511,6 @@ class _HourFormFieldState extends State<HourFormField> {
|
|||||||
TextSelection(baseOffset: 0, extentOffset: _controller.text.length);
|
TextSelection(baseOffset: 0, extentOffset: _controller.text.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (widget.category != null) {
|
if (widget.category != null) {
|
||||||
catNum = widget.category!.number.toString();
|
catNum = widget.category!.number.toString();
|
||||||
fgColor = widget.category!.foregroundColor;
|
fgColor = widget.category!.foregroundColor;
|
||||||
@ -528,6 +523,11 @@ class _HourFormFieldState extends State<HourFormField> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -536,15 +536,33 @@ class _HourFormFieldState extends State<HourFormField> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 50,
|
width: 50,
|
||||||
child: Consumer<DatabaseAPI>(builder: (context, database, child) {
|
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(
|
return TextFormField(
|
||||||
showCursor: false,
|
showCursor: false,
|
||||||
autofillHints: [],
|
autofillHints: [],
|
||||||
key: Key(
|
key: Key(
|
||||||
"hourField-${widget.dayEntry.$id}-${widget.index.toString()}"),
|
"hourField-${widget.dayEntry.$id}-${widget.index.toString()}"),
|
||||||
onTap: () {},
|
textInputAction: TextInputAction.next,
|
||||||
onEditingComplete: () {
|
onEditingComplete: () {
|
||||||
String value = _controller.value.text;
|
String value = _controller.value.text;
|
||||||
database.updateHours(widget.dayEntry, widget.index, value);
|
database.updateHours(widget.dayEntry, widget.index, value);
|
||||||
|
setState(() {
|
||||||
|
widget.category = categories.lookUp(num.parse(value));
|
||||||
|
catName = widget.category!.name;
|
||||||
|
});
|
||||||
_node.nextFocus();
|
_node.nextFocus();
|
||||||
},
|
},
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -556,6 +574,7 @@ class _HourFormFieldState extends State<HourFormField> {
|
|||||||
controller: _controller,
|
controller: _controller,
|
||||||
focusNode: _node,
|
focusNode: _node,
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
SizedBox(width: 40),
|
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