Closed JaydenBea closed 6 months ago
8:00pm - 8:15pm
7:30pm - 8:00pm
11:00pm - 11:30pm
TODO for later:
11:30pm - 12:00pm
7:10pm - 7:50pm
~12:00pm (start)
Fencepost
Starting on writing a FeederController to hold state information for the Feeder Page. Of note:
Feeder page can be in three different modes: an empty view, entry selection, and entry view
Empty view is 'default' view
User picks multiple entries to fill in entry selection
Entry view views an entry
12:30pm (since 12pm)
1:00pm (since 12:30pm, end)
1:30pm (start)
2:00pm (since 1:30pm)
2:30pm (since 2:00pm, end)
Moved all test data in FeederTable
to a separate file for convenience + sharing between all files
Added 'date' param to CellWrapper
(as its outside 'data', which holds all other cell info)
Added three placeholder methods in FeederSidebar
for its three modes. build()
will call one of these depending on controller.currentState
.
Did some research into nullable/non-nullable types in dart for a line
Need to add a station param to CellWrapper
(also outside, implied by data's position)
5:40pm (start)
Continuing earlier stuff
6:10pm (since 5:40pm, end)
9:30pm (start)
10:00pm (since 9:30pm)
10:30pm (since 10pm)
buildCell
to cellWrapper
, to keep cell formatting in one place.
FeederController
, FeederTable
and FeederSidebar
that implements selection mode. When an empty entry is clicked, it will move controller to selection mode and add the clicked entry to the Controller's list.TODO
11:00pm (since 10:30pm)
FeederController
to ensure controller is in a certain state, and that required variables are initialized, when certain methods are calledFeederSidebar
for displaying the user's selected entries.CellWrapper
to take a 'station' parameter, since selection mode must display this. Again, won't be required once DB is integrated into this code.~11:30pm (since 11pm, end)
CellWrapper
and buildRow
. entry['station']
holds the station name and entry['cats']
holds a list of cats. This will also be needed for view mode, which doesn't show sightings yet.addSelection
with toggleSelection
, which checks if the entry is in the list and toggles its presence.FeederSidebar
responds to calls to toggleSelection
. entries are added/removed successfully.For next time:
FeederTable
will need to listen to FeederController
.
addListeners
so that listeners don't call setState
unless they have to.Table
instead of a Row
of Containers
~4:30pm (start)
Table
.5:00pm (since 4:30pm, end)
Table
TODO
5:00pm (start)
5:30pm (since 5pm)
Resources:
6:00pm (since 5:30pm)
6:30pm (since 6pm)
7:00pm (since 6:30pm, end)
FirebaseHelper
that interface with different collections. Such functions are then called from the models, and the actual UI part of flutter calls those functions upon the model class instances.9:00pm (start)
9:30pm (since 9pm)
toJson
and fromJson
methodsFirebaseHelper
, as in the second video I referenced.
10pm (since 9:30pm)
10:30pm (since 10pm)
test_page.dart
with something that would display every entry, but the way the Entry class is set up right now doesn't properly accommodate the reference types in Firestore. Working to resolve.11pm (since 10:30pm)
Successfully modified Entry
's fields! Used a DocumentReference
type for the reference type, and the Timestamp
type for timestamp types. The latter is imported from the cloud firestore package, as in:
import 'package:cloud_firestore/cloud_firestore.dart';
With this addition, I removed the assignedUserCollection
, assignedUserPID
, stationCollection
, and stationPID
attributes from the class, as all of this information can be derived from the reference types.
assignedUser
nullable, to allow for empty entries.TestScreen
now prints a list of entries as expected. I'll now be adding a button and code that will generate some more entries that I can work with11:30pm (since 11pm)
addEntry
function to FirebaseHelper
7:30pm (since 7pm, start post unlogged)
UserDoc
. The name "User" isn't used because there's already a class in the firebase_auth
package with the same name.firebase_helper
for a reference to the users collection8pm (since 7:30pm, end)
12:10pm (start)
In class earlier:
FirebaseFirestore
object in FirebaseHelper
.Now:
FirebaseHelper
that will ensure a set of entries exists for the current date. It will check for the existence of entries before adding any.12:40pm (since 12:10)
ensureEntries
, which takes a DateTime
object and ensures all entries exist for that date. If an entry for a particular station exists, it will leave it alone, otherwise it will generate a new entry for it.FeederTable
's code to make DB calls and display all available entries. To account for weird errors, I'm going to make it display a row if and only if data is valid for that date (e.g., there's exactly one entry for that date for each station; no duplicates or missing entries).1:10pm (since 12:40)
ensureEntries
.FirebaseHelper
objects to feeder filesgetXStream
methods of FHStreamBuilder
to facilitate data access.1:40pm (since 1:10pm, end)
collection.dart
to make use of groupBy
to group entries by date. Returns a Map<Timestamp, List<QueryDocumentSnapshot<Entry>>>
.buildRows
, which will verify data in each entry of said map, then generate a row if data is valid. Planning to sort said list of rows after adding process, since Map doesn't sort its entries, of course.4:40pm (start)
newBuildRow
function for building a row from data.FeederTable
to use DB data instead of test data.5:10pm (since 4:40pm)
build
is being called before FeederTable's list of stations can be initialized.
test_page
after specifying the DocumentReference
type in Entry
. 5:40pm (since 5:10pm)
test_page
error by removing the type specifications and using a cast on the line that initially prompted me to change the types:
DocumentReference<UserDoc>? userID = data.data().assignedUser as DocumentReference<UserDoc>?; ```
6:20pm (since 5:10pm, end)
stations
not being initialized. Solution was to separate stations initialization code into a Future
-type method, initStations
, and encase the build return in a FutureBuilder
. At the beginning of the FutureBuilder
's body, a check is made for whether its snapshot has data; if not, a circular progress indicator is shown until it does.CellWrapper.build
wouldn't come in the right format. It doesn't come in through a converter for some reason. Using UserDoc.fromJson
alleviates the issue.todo:
10:10pm (start) Earlier:
SingleChildScrollView
Now
10:30pm (since 10:10pm, end)
DocumentReference? userID = data.data().assignedUser;
_feederName = 'placeholder / null';
int i = 0;
if(userID != null){
print('i before: $i');
fh.usersRef.doc(userID.id).get().then((value) {
UserDoc? userData = value.data();
if (userData == null) {
_feederName = 'ERROR';
} else {
print('first: ${userData.first}, last: ${userData.last}');
_feederName = "${userData.first} ${userData.last}";
print('changing i: $i');
}
},
onError: (e) => print(e));
print('aaa!');
print('i now: $i');
}
Upon running, this is printed:
i before: 0
aaa!
i now: 0
first: Ada, last: Lovelace
changing i: 0
Which indicates that the surrounding code body is running before the code in the then
method is finishing. I'm going to try and modify CellWrapper
to be a StatefulWidget
with a FutureBuilder
to force this code to run before the cell builds.
At 3pm, over the last two hours:
FeederDataSource
.
Todo:
FeederDataSource
that will return the name of a station given its document ID, for use by FeederSidebar
, which just prints the ID at present.7:50pm (start)
Earlier:
selectBody
that created the Table
selection into a separate asynchronous method, getSelectedEntryRows
, which calls getStation
of FeederDataSource to get the Station object referenced by an entry.
CellWrapper
that toggles cell color every time user selects or deselects an entry.
Over last ~30 minutes, in last commit (18a377c):
Main stuff:
toEmptyState()
in FeederController
so it transfers state to Empty and not SelectMinor stuff:
format
(DateFormat) to formatDashes
and moved it to FeederDataSource
.
feeder_test_data.dart
is now redundant.commonCellWrapping
to FeederTable
so the way cells are formatted is in one place. It takes an optional Color
parameter for use by the header row and CellWrapper.Over last ~30 minutes, in last commit (e6dfff6):
FirebaseHelper
for the document ID of the user who is signed inFeederController
for use in select mode that updates selected entries to reference the signed-in user.
FeederSidebar
's select mode to call this function when the Confirm button is hit.CellWrapper
as a listener to FeederController
, so that it can become deselected when Select mode is exited.3pm (start) (I forgot to comment this whoops)
Next step is modifications to FeederSidebar
's entry view mode UI:
3:30pm (since 3pm)
CellWrapper
's fields regarding color to an enum for selection status, with variables.
CellSelectStatus
enum has three instances: inactive
(unselected cells), adding
(empty cells being selected), and viewing
(non-empty cells being viewed). Each has a color parameter that shows what color to display on cell.CellWrapper
s now just have a CellSelectStatus
field. Instead of having a color field, this field's color attribute is passed inside of build.FeederController
PageState, and whether they have data.FeederSidebar
's view mode to a mapping for easier editing
7:30pm - ??:??