mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-07-12 22:11:00 +02:00
feat(dissertation): add code example for modular compose functions
This commit is contained in:
parent
1c0060d0bb
commit
0e6f11b61c
@ -102,8 +102,9 @@ Brief overview of what it is supposed to do... % TODO
|
|||||||
for runtime environments to be specified (in this case, Desktop and Server)
|
for runtime environments to be specified (in this case, Desktop and Server)
|
||||||
\item Provides necessary build configurations in Gradle
|
\item Provides necessary build configurations in Gradle
|
||||||
\item Planning what to implement important as Compose is designed to use modular
|
\item Planning what to implement important as Compose is designed to use modular
|
||||||
components, otherwise a nested mess would happen, code harder to read
|
components, otherwise a nested mess would happen, code harder to read.
|
||||||
% TODO add example
|
Figure~\ref{fig:compose-modular} shows example of using modular code
|
||||||
|
from the Actions screen in project (with code omissions)
|
||||||
\item Used Voyager~\cite{voyager} to handle screens
|
\item Used Voyager~\cite{voyager} to handle screens
|
||||||
\item Used Koin~\cite{koin} for dependency injection, to be able to get data from the
|
\item Used Koin~\cite{koin} for dependency injection, to be able to get data from the
|
||||||
database and VDMJ
|
database and VDMJ
|
||||||
@ -115,6 +116,16 @@ Brief overview of what it is supposed to do... % TODO
|
|||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
|
\begin{figure}
|
||||||
|
\centering
|
||||||
|
\inputminted[
|
||||||
|
linenos,
|
||||||
|
breaklines,
|
||||||
|
]{kotlin}{code/compose-modular.kt}
|
||||||
|
\caption[Compose Modular Example]{Example of modular code in Compose}
|
||||||
|
\label{fig:compose-modular}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
\subsection{Storing Data}
|
\subsection{Storing Data}
|
||||||
|
|
||||||
|
|
||||||
|
55
pub/dissertation/code/compose-modular.kt
Normal file
55
pub/dissertation/code/compose-modular.kt
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
@Composable
|
||||||
|
override fun Content() {
|
||||||
|
// Content variables...
|
||||||
|
|
||||||
|
Scaffold(
|
||||||
|
topBar = {/* Composable content... */},
|
||||||
|
) {
|
||||||
|
Column(/* Column option parameters... */) {
|
||||||
|
Box(/* Box option parameters... */) {
|
||||||
|
LazyColumn(/* LazyColumn option parameters... */) {
|
||||||
|
|
||||||
|
item {
|
||||||
|
Header()
|
||||||
|
}
|
||||||
|
|
||||||
|
items(
|
||||||
|
items = inputs,
|
||||||
|
key = { input -> input.id }
|
||||||
|
) { item ->
|
||||||
|
ActionItem(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun Header() {
|
||||||
|
Text(text = "Edit Actions")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun ActionItem(item: Action) {
|
||||||
|
Column (/* Column option parameters... */) {
|
||||||
|
Row(/* Row option parameters... */) {
|
||||||
|
Text(text = "Action ${item.step + 1}")
|
||||||
|
|
||||||
|
IconButton(/* IconButton definition parameters... */) {
|
||||||
|
Icon(
|
||||||
|
Icons.Outlined.Delete,
|
||||||
|
// Rest of Icon options...
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(/* Row option parameters... */) {
|
||||||
|
OutlinedTextField(/* TextField definition parameters... */)
|
||||||
|
|
||||||
|
OutlinedTextField(/* TextField definition parameters... */)
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider()
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
%\usepackage{vdmlisting}
|
%\usepackage{vdmlisting}
|
||||||
\usepackage{listings}
|
\usepackage{listings}
|
||||||
|
\usepackage{minted}
|
||||||
% Taken from vdmlisting
|
% Taken from vdmlisting
|
||||||
\lstdefinelanguage{VDM_SL}
|
\lstdefinelanguage{VDM_SL}
|
||||||
{morekeywords={RESULT,\#else,\#endif,\#ifdef,\#ifndef,abs,all,always,and,as,atomic,be,be st,bool,by,card,cases,char,comp,compose,conc,dcl,def,definitions,dinter,div,dlmodule,do,dom,dunion,
|
{morekeywords={RESULT,\#else,\#endif,\#ifdef,\#ifndef,abs,all,always,and,as,atomic,be,be st,bool,by,card,cases,char,comp,compose,conc,dcl,def,definitions,dinter,div,dlmodule,do,dom,dunion,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user