Skip to content

Instantly share code, notes, and snippets.

@gladimdim
Created July 24, 2019 12:32
Show Gist options
  • Save gladimdim/5b419d7178b654f846ea1fb14d25404c to your computer and use it in GitHub Desktop.
Save gladimdim/5b419d7178b654f846ea1fb14d25404c to your computer and use it in GitHub Desktop.
Expanded(
child: SingleChildScrollView(
controller: _passageScrollController,
child: Column(
children: [
...widget.currentStory.storyHistory.getHistory().map((var passageItem) {
if (passageItem == null) {
return Container();
}
Widget container;
switch (passageItem.type) {
case PassageTypes.IMAGE:
container = BorderedRandomImageByPath(passageItem.value);
break;
case PassageTypes.TEXT:
container = Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.all(8.0),
margin: EdgeInsets.all(8.0),
width: MediaQuery.of(context).size.width * 0.95,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
border: Border.all(
color: Theme.of(context).primaryColor,
width: 3.0,
),
),
child: Text(
passageItem.value == "" ? "Початок" : passageItem.value,
style: TextStyle(
fontFamily: "Raleway-Bold",
fontSize: 18,
),
),
);
}
return container;
}),
if (widget.currentStory.theEnd || widget.currentStory.toBeContinued)
..._buildTheEnd(context),
],
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment