diff --git a/ltx_flutter/flake.lock b/ltx_flutter/flake.lock new file mode 100644 index 0000000..b5966a1 --- /dev/null +++ b/ltx_flutter/flake.lock @@ -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 +} diff --git a/ltx_flutter/flake.nix b/ltx_flutter/flake.nix new file mode 100644 index 0000000..13584b7 --- /dev/null +++ b/ltx_flutter/flake.nix @@ -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 + ]; + }; + }); +} diff --git a/ltx_flutter/lib/pages/tabs_page.dart b/ltx_flutter/lib/pages/tabs_page.dart index 3bc68e6..33995ad 100644 --- a/ltx_flutter/lib/pages/tabs_page.dart +++ b/ltx_flutter/lib/pages/tabs_page.dart @@ -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 { 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 { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: StreamBuilder( - stream: appBloc.titleStream, - initialData: "Flutter", - builder: (context, snapshot) { - return Text(snapshot.data.toString()); - }), - ), + // appBar: AppBar( + // title: StreamBuilder( + // 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( diff --git a/ltx_flutter/lib/pages/today_page.dart b/ltx_flutter/lib/pages/today_page.dart index 54abed3..84b3491 100644 --- a/ltx_flutter/lib/pages/today_page.dart +++ b/ltx_flutter/lib/pages/today_page.dart @@ -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() + ); } } diff --git a/ltx_flutter/lib/pages/today_views/day_view.dart b/ltx_flutter/lib/pages/today_views/day_view.dart index 99e9d65..d6798f1 100644 --- a/ltx_flutter/lib/pages/today_views/day_view.dart +++ b/ltx_flutter/lib/pages/today_views/day_view.dart @@ -528,6 +528,12 @@ class _HourFormFieldState extends State { @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 { "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 { ); } } +String getPreviousHourValue(widget) { + int prevIndex = widget.index - 1; + if(prevIndex < 0){ return "0";} + else{ + return widget.dayEntry.data['hours'][prevIndex].toString(); + } +}