Clean up layout; fix colors and auto-populate

This commit is contained in:
Ryan Pandya 2023-10-13 12:53:31 -07:00
parent 7b8cb39567
commit d7ecab3415
5 changed files with 135 additions and 34 deletions

61
ltx_flutter/flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1685566663,
"narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4ecab3273592f27479a583fb6d975d4aba3486fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

38
ltx_flutter/flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
description = "Flutter 3.0.4";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
buildToolsVersion = "30.0.3";
androidComposition = pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ buildToolsVersion "28.0.3" ];
platformVersions = [ "31" "28" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
};
androidSdk = androidComposition.androidsdk;
in
{
devShell =
with pkgs; mkShell rec {
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
buildInputs = [
chromium
flutter
androidSdk
jdk11
android-studio
];
};
});
}

View File

@ -2,6 +2,7 @@ import 'package:ltx_flutter/pages/account_page.dart';
import 'package:ltx_flutter/pages/categories_page.dart';
import 'package:ltx_flutter/pages/today_page.dart';
import 'package:flutter/material.dart';
import 'package:ltx_flutter/pages/today_views/infinity_view.dart';
import '../app_properties_bloc.dart';
class TabsPage extends StatefulWidget {
@ -14,7 +15,7 @@ class TabsPage extends StatefulWidget {
class _TabsPageState extends State<TabsPage> {
int _selectedIndex = 0;
static const _widgets = [TodayPage(), CategoriesPage(), AccountPage()];
static const _widgets = [TodayPage(), InfinityView(), CategoriesPage(), AccountPage()];
void _onItemTapped(int index) {
setState(() {
@ -25,19 +26,22 @@ class _TabsPageState extends State<TabsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: StreamBuilder<Object>(
stream: appBloc.titleStream,
initialData: "Flutter",
builder: (context, snapshot) {
return Text(snapshot.data.toString());
}),
),
// appBar: AppBar(
// title: StreamBuilder<Object>(
// stream: appBloc.titleStream,
// initialData: "Flutter",
// builder: (context, snapshot) {
// return Text(snapshot.data.toString());
// }),
// ),
body: _widgets.elementAt(_selectedIndex),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.today_outlined), label: "Today"),
BottomNavigationBarItem(
icon: Icon(Icons.all_inclusive), label: "Grid"),
BottomNavigationBarItem(
icon: Icon(Icons.category_outlined), label: "Categories"),
BottomNavigationBarItem(

View File

@ -43,29 +43,7 @@ class NarrowView extends StatelessWidget {
return DefaultTabController(
length: 4,
initialIndex: 0,
child: Column(
children: [
TabBar(
tabs: [
Tab(icon: Icon(Icons.calendar_view_day)),
Tab(icon: Icon(Icons.calendar_view_week)),
Tab(icon: Icon(Icons.calendar_view_month)),
Tab(icon: Icon(Icons.all_inclusive)),
],
),
Expanded(
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
children: [
DayView(),
WeekView(),
Icon(Icons.directions_car, size: 350),
InfinityView(),
],
),
)
],
),
child: DayView()
);
}
}

View File

@ -528,6 +528,12 @@ class _HourFormFieldState extends State<HourFormField> {
@override
Widget build(BuildContext context) {
if (widget.category != null) {
catNum = widget.category!.number.toString();
fgColor = widget.category!.foregroundColor;
catName = widget.category!.name;
}
return Row(
children: [
SizedBox(
@ -557,7 +563,14 @@ class _HourFormFieldState extends State<HourFormField> {
"hourField-${widget.dayEntry.$id}-${widget.index.toString()}"),
textInputAction: TextInputAction.next,
onEditingComplete: () {
String value = _controller.value.text;
String value;
String current = _controller.value.text;
if(current == ""){
value = getPreviousHourValue(widget);
}
else{
value = current;
}
database.updateHours(widget.dayEntry, widget.index, value);
setState(() {
widget.category = categories.lookUp(num.parse(value));
@ -588,3 +601,10 @@ class _HourFormFieldState extends State<HourFormField> {
);
}
}
String getPreviousHourValue(widget) {
int prevIndex = widget.index - 1;
if(prevIndex < 0){ return "0";}
else{
return widget.dayEntry.data['hours'][prevIndex].toString();
}
}