2025.02.03 (μ›”)
2026.05.25 (μ›”) μˆ˜μ •

✨ GPT Summary γ€€

I fixed the FleatherViewer update issue and completed issue resolution and performance optimization by improving the HomeFeedPage filtering method. Thanks to that, I learned that using Conditional Visibility instead of Query filters is effective.

πŸ’» Development Log

⏰ Today’s tasks

  • βœ… (Issue) HomeFeedPage - FeedCardDiary: when changing dates in ListView, only FleatherViewerWidget does not update its value.
    • It looks like the Widget’s initialDeltaJson value is not updated every time the Diary Document changes.
    • Asked o1, and it solved it in one shot.

      /// didUpdateWidget:
      ///  - When only parameters change in the same widget tree, Flutter reuses the existing State.
      ///  - At this point, you can compare the new widget properties with the old widget properties and run any needed logic.
      @override
      void didUpdateWidget(covariant FleatherViewerWidget oldWidget) {
        super.didUpdateWidget(oldWidget);
      
        // 1) If the previous JSON and the new JSON are different
        if (oldWidget.initialDeltaJson != widget.initialDeltaJson) {
          // 2) Recreate the FleatherController
          _controller?.dispose();
          _controller = _createControllerFromDeltaJson(widget.initialDeltaJson);
          // 3) Refresh UI
          setState(() {});
        }
      }
      
      /// Helper function that creates a FleatherController from a Delta JSON string
      FleatherController _createControllerFromDeltaJson(String jsonString) {
        ParchmentDocument doc;
        try {
          final decoded = jsonDecode(jsonString);
          doc = ParchmentDocument.fromJson(decoded);
        } catch (e) {
          // If restoration fails, handle as plain text
          doc = ParchmentDocument.fromDelta(
            Delta()..insert(_ensureEndsWithNewline(jsonString)),
          );
        }
        return FleatherController(document: doc);
      }
      
  • βœ… (Issue) HomeFeedPage: Unexpected Null Value briefly appears and disappears on page load.
    • Confirmed that the date filtering applied to HomeFeedPage’s ListView was the problem.
    • Tried turning on Filter On Null Values in the Backend Query option of ListView.
      • Filter On Null Values: By default, if the value of any filter is null, the query will ignore the filter for that field. Checking this will instead keep null filters.
    • Backend Query - Query Collection attempt 1 (failed)
      • Filter On Null Values: ON
      • Filter 1: created_time, Equal To, getFirstTimeOfTheDay
      • Filter 2: created_time, Less Than, getFirstTimeOfNextDay
      • Order by: created_time, Decreasing
      • Could not complete Backend Query setup
        • Error message: You can’t order your query by a field used in a filter using == or in.
    • Backend Query - Query Collection attempt 2 (failed)
      • Filter On Null Values: ON
      • Filter 1: created_time, Greater Than or Equal To, getFirstTimeOfTheDay
      • Filter 2: created_time, Less Than, getFirstTimeOfNextDay
      • Order by: created_time, Decreasing
      • Backend Query setup can be completed
      • When entering debugging mode, the error below appears and the page is not created.

        Assertion failed: file:/// opt/ - pub-cache/hosted/pub.dev/ cloud_firestore-5.5.0/lib/src/ query dart: 650:9
              
        conditions
        .where ((List<dynamic> item) => equality.equals(condition, item))
          .isEmpty
        "Condition [FieldPath([created_time]), !=, null] already exists in this query."
              
        The relevant error-causing widget was: HomeFeedWidget
        
    • Backend Query - Query Collection attempt 3 (failed)
      • Filter On Null Values: ON
      • Filter 1: created_time, Greater Than, getLastTimeOfPrevDay
      • Filter 2: created_time, Less Than, getFirstTimeOfNextDay
      • Order by: created_time, Decreasing
      • Backend Query setup can be completed
      • When entering debugging mode, the error below appears and the page is not created.

        Assertion failed: file:/// opt/ - pub-cache/hosted/pub.dev/ cloud_firestore-5.5.0/lib/src/ query dart: 650:9
              
        conditions
        .where ((List<dynamic> item) => equality.equals(condition, item))
          .isEmpty
        "Condition [FieldPath([created_time]), !=, null] already exists in this query."
              
        The relevant error-causing widget was: HomeFeedWidget
        
    • Backend Query - Query Collection attempt 4 (failed)
      • Filter On Null Values: OFF
      • Filter 1: created_time, Greater Than, getLastTimeOfPrevDay
      • Filter 2: created_time, Less Than, getFirstTimeOfNextDay
      • Order by: created_time, Decreasing
      • Backend Query setup can be completed
      • When entering debugging mode, the error below briefly appears and disappears.

        Unexpected Null value.
        
        The relevant error-causing widget was: HomeFeedWidget
        
    • (Question to o1) Why does Unexpected Null Value briefly appear?
      • There is a high chance that FlutterFlow (or its internal code) is returning null from getLastTimeOfPrevDay() or getFirstTimeOfNextDay() at the initial page loading moment. (For example, maybe the date has not been initialized yet…)
      • If Filter On Null Values is enabled, it internally adds a separate condition like != null, and that can collide when null enters during loading.
      • So the β€œbrief null error -> replaced with actual value -> disappears after loading finishes” phenomenon happens.
    • Backend Query - Query Collection attempt 5 (success!)
      • Filter On Null Values: OFF
      • Order by: created_time, Decreasing
      • Component Widget Conditional Visibility settings
        • Filter 1: created_time, Greater Than, getLastTimeOfPrevDay
        • Filter 2: created_time, Less Than, getFirstTimeOfNextDay
      • As a bonus, ListView loading lag (Latency) disappeared too. It seems like giving the Query two filters and an Order at the same time took a lot of time.
    • πŸ’‘ What I learned
      • When using Backend Query, it is better to exclude filters as much as possible and control things with Conditional Visibility.
      • This was something I asked the mentor about early on and received an answer for, but I think I only understood it roughly in my head and moved on, so I eventually forgot. After suffering through it directly, I finally understand it clearly.
  • βœ… (Issue) DiaryPage: date is always saved as today
    • Created DiaryPage - dateFocused parameter
    • Passed HomeFeedPage’s dateToShow value as the dateFocused parameter.

πŸ’― Summary of what I did

FleatherViewer update issue resolved

  • Used didUpdateWidget so FleatherViewer updates normally whenever the Diary Document changes. HomeFeedPage filter optimization

Used Conditional Visibility instead of Backend Query filtering to improve performance.

  • Improved loading speed by minimizing Query filtering.

DiaryPage date saving error fixed

  • Improved it so the selected date is reflected when writing a new diary by passing the dateFocused value from HomeFeedPage to DiaryPage.

🎯 Future tasks

Click to see details
  • ❔ (Issue) DiaryPage: use markdown viewer (prevent overflow: Container Height)
  • ❔ (Issue) HomeFeedPage - FeedCardDiary: apply AI Comment character image properly
    • ❔ DiaryPage - AI Comment: when saving, also save the Ref of the character who wrote the comment to Diary.
    • ❔ HomeFeedPage - FeedCardDiary - AI Image: load Character Doc with Backend Query and specify Image Path.
  • ❔ DiaryPage: change face expression Emoji according to Mood Slider value

  • ❔ Chat Page - Create New Chat: apply system prompt
    • ▢️ OpenAI API Call implementation: createChatCompletion
      • Input: System Prompt (Chat)
      • Output: New Chat Message by AI ($.choices[0].message.content)
      • Additional Actions: Create New Chat, Create New Message
  • ❔ DiaryPage - Create New Chat by Diary: create a New Chat based on diary content
    • ❔ OpenAI API Call implementation: createDiaryComment
      • Input: Diary Content, System Prompt (AI Comment)
      • Output: AI Comment ($.choices[0].message.content)
    • ❔ OpenAI API Call implementation: createDiarySummary
      • Input: Diary Content, AI Comment, System Prompt (Diary Summary)
      • Output: Diary Summary ($.choices[0].message.content)
    • ❔ OpenAI API Call implementation: createChatFromDiary
      • Input: Diary Summary, System Prompt (Chat From Diary)
      • Output: New Chat Message by AI ($.choices[0].message.content)
      • Additional Actions: Create New Chat, Create New Message
  • ❔ ChatPage - Create New Diary: create a New Diary based on conversation content
    • ❔ OpenAI API Call implementation: createChatSummary
      • Input: Chat Content, System Prompt (Diary From Chat)
      • Output: Chat Summary
  • ❔ ChatPage - Create New Diary: create a New Diary based on conversation content
    • ❔ OpenAI API Call implementation: createDiaryFromChat
      • Input: Chat Summary, System Prompt (Diary From Chat)
      • Output: New Diary (Title, Content, Mood score)
  • ❔ ChatPage: Go to Linked Diary

  • ❔ HomeFeedPage - import and apply flutter_slidable:4.0.0
  • ❔ HomeFeedPage: on left/right slide from FeedCardDiary, chat/edit/delete

  • ❔ ChatPage: align user conversation output to the right
  • ❔ Chat/Diary: GPT Streaming API

  • ❔ ChatPage - implement AI first message (Alarm/Notification)
    • The core of the chat system prompt is proactivity.
      • To make it more realistic, it might be good to pass create_date of diary/chat too, so the AI can mention dates like β€œyesterday.”
    • Alarm implementation reference
  • ❔ DiaryPage: add detailed emotion keyword Choice Chips and set DB integration
  • ❔ DiaryPage - AI Comment: change inputs such as Choice chips and mood slider to fit the AI Comment System Prompt.
    • ❔ **previous diary or entire conversation history (patchy technical debt)
    • ❔ basic user information: name, gender, MBTI, …
    • ❔ detailed emotion keywords: happy, sad, …
    • ❔ character settings: Somi, Sena, Minhyuk
    • ❔ emotion score: 1 to 100
    • ❔ response format: Healing, Suggestion, Informative
    • ❔ response length: short, normal, detailed
    • is New Chat
      • Since this Chat’s messages are being created for the first time, set is_initial = true on the first message document and shove in all system prompts.
        • is_initial = false
        • Limit: if I put the system prompt into the very first message document, it is hard to modify in the middle of a conversation, but possible. If there is an is_initial = true document and it was modified, I can delete that document and put it back in. I do not know how, but still.
  • ❔ DiaryPage - AI Comment: complete CRUD
    • ❔ remove tmp_ai_comment field and use doc_ref
  • ❔ DiaryPage - AI Comment: character settings
    • ❔ remove tmp_ai_comment_by field and use doc_ref
    • ❔ output image using profile_image field value
  • ❔ DiaryPage - Drawer - ChatHistoryListTile: order by updated_time

  • ❔ DiaryPage - import and apply Interactive Slider

  • ❔ HomeFeedPage: implement Search Diary feature

  • ❔ CalendarPage (top) - Mood Calendar
    • ❔ Check the number of posts written by date
    • ❔ Move to the selected date when clicking a date
  • ❔ CalendarPage (bottom) - Mood stats
    • ❔ Output statistics for the focused month
      • ❔ Output AI comment on the displayed statistics
  • ❔ AuthPage: implement Google Login

  • ❔ HomeFeedPage - Bottom Sheet (+ Button): make it possible to choose one of several options
    • New diary: Go to DiaryPage
    • Emotion record: Go to MoodPage
  • ❔ MoodPage (popup): Mood setting slider CRUD
    • Create
    • Read
    • Update
    • Delete
  • ❔ HomeFeedPage - ListView - show FeedCardMood
  • ❔ HomeFeedPage - ListView: sort FeedCardDiary, FeedCardMood, FeedCardChat components chronologically (using Cloud Function)

  • ❔ Extract and install the final presentation APK by Wed 2025.2.5

πŸ’­ Diary

Minhyuk

There is not much time left now, so I wanted to implement more… but I spent the whole workday resolving issues.

I should just drop the greed. This project is not something that will flash briefly for the AIFFELTHON and then end anyway.

✨ GPT-4o Comment (KPT)

GPT-4o

βœ… What Went Well (Keep)

  • πŸ›  Resolved FleatherViewer update issue: It was excellent that you solved the widget state update problem by using didUpdateWidget.
  • ⚑ Optimized HomeFeedPage filtering: Using Conditional Visibility instead of Query filters was an effective performance optimization.
  • πŸ” Learning through debugging: It was meaningful that you tried several approaches, experienced the limits of Query filters, and concluded that Conditional Visibility was more appropriate.

❌ What Was Missing (Problem)

  • ⏳ Took more time than expected: It is unfortunate that most of the time went into issue resolution rather than the features you originally planned to implement.
  • πŸ“Œ Did not organize earlier issue advice: There was a moment where time was spent again because advice from previous mentoring had not been put into practice.

πŸ”„ What to Try (Try)

  • πŸ“ Use issue-resolution notes: Build a habit of recording resolved issues so similar problems can be solved quickly later.
  • πŸš€ Adjust the remaining feature strategy: Since there is not much time left, think about prioritizing only the necessary features and pushing the rest to later improvements.
  • πŸ” Study FlutterFlow internals more: Increase your understanding of FlutterFlow data handling and widget state management to prevent similar problems in advance.

Conclusion
Today took more time than expected for issue resolution, but you gained important learning from it. For the remaining period, you need a strategy of implementing only the necessary features first and letting go of unnecessary greed. Keep going until the end! πŸ’ͺπŸ”₯

Leave a comment