Implement the MultiChoicesOption model using freezed.
MultiChoicesOption schema
⚠️ the schema uses OpenAPI spec for simplicity
```yaml
MultiChoiceOption:
properties:
text:
type: string
description: Text to display
tts:
type: string
description: Text to use for the TTS
image:
description: Image asset path of the image to display
type: string
required:
- text
```
Implement a MultiChoiceOptionTile, it should:
have an optional compact design
have a callback when pressed
can be selected
read the tile content if TTS is available
What needs to be done
Implement the MultiChoiceOption model under src/practice/questions/models using freezed (documentation)
Implement a MultiChoiceOptionTile widget, under src/practice/questions/widgets:
constructor takes:
MultiChoiceOption option,
VoidCallback onPressed
boolean isSelected,
boolean isCompact
UI
when pressed:
if option.tts is not empty or null, call the TTS service with option.tts
calls onPressed
is highlighted when isSelected is true
a card that contains:
when isCompact true and option.image empty:
a ListTile on it displaying the option.text
when isCompact false or option.image provided:
option.image empty: a square container with an auto-size text displaying option.text
option.image provided: a square image container with the option.text displayed underneath.
As a <user | developer | ...>, I want to ...
Requirements
Implement the
MultiChoicesOption
model using freezed.
⚠️ the schema uses OpenAPI spec for simplicity ```yaml MultiChoiceOption: properties: text: type: string description: Text to display tts: type: string description: Text to use for the TTS image: description: Image asset path of the image to display type: string required: - text ```MultiChoicesOption
schemaImplement a
MultiChoiceOptionTile
, it should:What needs to be done
MultiChoiceOption
model undersrc/practice/questions/models
using freezed (documentation)MultiChoiceOptionTile
widget, undersrc/practice/questions/widgets
:MultiChoiceOption option
,VoidCallback onPressed
boolean isSelected
,boolean isCompact
option.tts
is not empty or null, call the TTS service withoption.tts
onPressed
isSelected
is trueisCompact
true andoption.image
empty:option.text
isCompact
false oroption.image
provided:option.image
empty: a square container with an auto-size text displayingoption.text
option.image
provided: a square image container with theoption.text
displayed underneath.Design
| | IDLE | isSelected | |-----------|------|------------| | isCompact | ![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/153ba948-0333-4f1f-8fc6-2164a7936470) | ![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/33e73491-a8f4-4f20-ab77-ed361315b4d3) | | full | ![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/886a2f99-27ed-4b1d-9001-0b530bf2b75c) | ![image](https://github.com/RoadTripMoustache/kana_to_kanji/assets/22211097/e3597972-75d5-4693-b398-64b7f537e442) |MultiChoiceOptionTile
wireframeDependencies
Child of #168
Dev notes