Settings screen in SwiftUI, Flutter, React Native and HTML/CSS
A settings list in all four targets: profile card, grouped rows, drawn toggles and a destructive action.
A settings screen is a stack of rows that all have to agree: labels on the left, controls or values on the right, a divider between rows, and the same corner radius on every group. We drew one at 390 by 844 (an iPhone 14) with a profile card, two grouped lists, three toggles, a value row and a sign out button, and exported it to all four targets. The code below is the generator's output, unedited. It is also the longest of these exports, because every row is its own positioned element.
What we drew
| Element | Position | Size | Notes |
|---|---|---|---|
| Title, "Settings" | x 24, y 72 | 342 x 44 | 34px, bold |
| Profile card | x 24, y 136 | 342 x 88 | white, radius 16, 1px border |
| Avatar | x 40, y 152 | 56 x 56 | circle, blue, initials centred |
| Name and email | x 112, y 160 and 186 | 230 wide | 17px semibold and 14px grey |
| "NOTIFICATIONS" | x 24, y 256 | 342 x 16 | 12px, semibold, letter-spaced |
| Notification group | x 24, y 280 | 342 x 156 | three rows of 52 |
| Toggle, push (on) | x 306, y 291 | 51 x 31 | knob 27, at x 328 |
| Toggle, email digest (on) | x 306, y 343 | 51 x 31 | knob 27, at x 328 |
| Toggle, sound (off) | x 306, y 395 | 51 x 31 | knob 27, at x 308 |
| "GENERAL" | x 24, y 468 | 342 x 16 | same style as the other section label |
| General group | x 24, y 492 | 342 x 104 | two rows of 52: Language, Storage |
| "Sign out" | x 24, y 628 | 342 x 52 | outlined, red label, radius 16 |
| Version | x 24, y 700 | 342 x 18 | 13px, grey, centred |
The rows are 52 tall and the arithmetic is the whole design. The notification group is 156 = 3 x 52, and its row dividers sit on the row boundaries at y 331 and 383 (280 + 52 − 1 and 280 + 104 − 1), one pixel above each boundary so the line belongs to the row it closes. Each toggle is 31 tall, so it is vertically centred in its row at 11 from the top and 10 from the bottom (a 51 by 31 pill in a 52 row). The knob is 27 inside a 31 pill, which leaves a 2 inset on every side, so an off knob sits at the pill's x + 2 and an on knob at x + 51 − 27 − 2 = x + 22.
React Native
Each toggle is a Pressable holding a pill and a knob, with its own handler (togglePush, toggleDigest, toggleSound). The group wrapper is what makes a tap anywhere on the pill, including the knob, count.
import React from 'react';
import { View, Text, Pressable, StyleSheet } from 'react-native';
export default function Settings() {
const togglePush = () => {};
const toggleDigest = () => {};
const toggleSound = () => {};
const handleSignOut = () => {};
return (
<View style={styles.screen}>
<Text style={styles.title}>{"Settings"}</Text>
<View style={styles.card2} />
<View style={styles.avatar} />
<View style={styles.initials}><Text style={styles.initialsText}>{"AK"}</Text></View>
<Text style={styles.label5}>{"Ada King"}</Text>
<Text style={styles.label6}>{"[email protected]"}</Text>
<Text style={styles.label7}>{"NOTIFICATIONS"}</Text>
<View style={styles.card8} />
<Text style={styles.label9}>{"Push notifications"}</Text>
<View style={styles.ruleOne} />
<Text style={styles.label11}>{"Email digest"}</Text>
<View style={styles.ruleTwo} />
<Text style={styles.label13}>{"Sound"}</Text>
<Pressable onPress={togglePush} style={({ pressed }) => [styles.group, pressed && styles.pressed]}>
<View style={styles.pushSwitch} />
<View style={styles.pushKnob} />
</Pressable>
<Pressable onPress={toggleDigest} style={({ pressed }) => [styles.group2, pressed && styles.pressed]}>
<View style={styles.digestSwitch} />
<View style={styles.digestKnob} />
</Pressable>
<Pressable onPress={toggleSound} style={({ pressed }) => [styles.group3, pressed && styles.pressed]}>
<View style={styles.soundSwitch} />
<View style={styles.soundKnob} />
</Pressable>
<Text style={styles.label20}>{"GENERAL"}</Text>
<View style={styles.card21} />
<Text style={styles.label22}>{"Language"}</Text>
<Text style={styles.label23}>{"English"}</Text>
<Text style={styles.label24}>{"›"}</Text>
<View style={styles.ruleThree} />
<Text style={styles.label26}>{"Storage"}</Text>
<Text style={styles.label27}>{"1.2 GB"}</Text>
<Pressable onPress={handleSignOut} style={({ pressed }) => [styles.group4, pressed && styles.pressed]}>
<View style={styles.signOut} />
<View style={styles.signOutLabel}><Text style={styles.signOutLabelText}>{"Sign out"}</Text></View>
</Pressable>
<Text style={styles.label30}>{"Version 2.4.1"}</Text>
</View>
);
}
const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: '#F6F4EE',
},
title: {
position: 'absolute',
left: 24,
top: 72,
width: 342,
height: 44,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 34,
lineHeight: 44,
textAlign: 'left',
fontWeight: '700',
},
card2: {
position: 'absolute',
left: 24,
top: 136,
width: 342,
height: 88,
borderRadius: 16,
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#E4E1D8',
},
avatar: {
position: 'absolute',
left: 40,
top: 152,
width: 56,
height: 56,
borderRadius: 28,
backgroundColor: '#2A50D8',
},
initials: {
position: 'absolute',
left: 40,
top: 152,
width: 56,
height: 56,
justifyContent: 'center',
},
initialsText: {
color: '#ffffff',
fontFamily: 'Inter',
fontSize: 20,
lineHeight: 26,
textAlign: 'center',
fontWeight: '600',
},
label5: {
position: 'absolute',
left: 112,
top: 160,
width: 230,
height: 24,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 17,
lineHeight: 22,
textAlign: 'left',
fontWeight: '600',
},
label6: {
position: 'absolute',
left: 112,
top: 186,
width: 230,
height: 20,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 14,
lineHeight: 18,
textAlign: 'left',
},
label7: {
position: 'absolute',
left: 24,
top: 256,
width: 342,
height: 16,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 12,
lineHeight: 16,
textAlign: 'left',
fontWeight: '600',
letterSpacing: 1,
},
card8: {
position: 'absolute',
left: 24,
top: 280,
width: 342,
height: 156,
borderRadius: 16,
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#E4E1D8',
},
label9: {
position: 'absolute',
left: 40,
top: 296,
width: 240,
height: 20,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'left',
},
ruleOne: {
position: 'absolute',
left: 40,
top: 331,
width: 326,
height: 1,
borderRadius: 0,
backgroundColor: '#EDEAE0',
},
label11: {
position: 'absolute',
left: 40,
top: 348,
width: 240,
height: 20,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'left',
},
ruleTwo: {
position: 'absolute',
left: 40,
top: 383,
width: 326,
height: 1,
borderRadius: 0,
backgroundColor: '#EDEAE0',
},
label13: {
position: 'absolute',
left: 40,
top: 400,
width: 240,
height: 20,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'left',
},
group: {
position: 'absolute',
left: 306,
top: 291,
width: 51,
height: 31,
},
pushSwitch: {
position: 'absolute',
left: 0,
top: 0,
width: 51,
height: 31,
borderRadius: 16,
backgroundColor: '#2A50D8',
},
pushKnob: {
position: 'absolute',
left: 22,
top: 2,
width: 27,
height: 27,
borderRadius: 14,
backgroundColor: '#ffffff',
shadowColor: '#000000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 1,
shadowRadius: 3,
elevation: 3,
},
group2: {
position: 'absolute',
left: 306,
top: 343,
width: 51,
height: 31,
},
digestSwitch: {
position: 'absolute',
left: 0,
top: 0,
width: 51,
height: 31,
borderRadius: 16,
backgroundColor: '#2A50D8',
},
digestKnob: {
position: 'absolute',
left: 22,
top: 2,
width: 27,
height: 27,
borderRadius: 14,
backgroundColor: '#ffffff',
shadowColor: '#000000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 1,
shadowRadius: 3,
elevation: 3,
},
group3: {
position: 'absolute',
left: 306,
top: 395,
width: 51,
height: 31,
},
soundSwitch: {
position: 'absolute',
left: 0,
top: 0,
width: 51,
height: 31,
borderRadius: 16,
backgroundColor: '#D7D3C8',
},
soundKnob: {
position: 'absolute',
left: 2,
top: 2,
width: 27,
height: 27,
borderRadius: 14,
backgroundColor: '#ffffff',
shadowColor: '#000000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 1,
shadowRadius: 3,
elevation: 3,
},
label20: {
position: 'absolute',
left: 24,
top: 468,
width: 342,
height: 16,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 12,
lineHeight: 16,
textAlign: 'left',
fontWeight: '600',
letterSpacing: 1,
},
card21: {
position: 'absolute',
left: 24,
top: 492,
width: 342,
height: 104,
borderRadius: 16,
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#E4E1D8',
},
label22: {
position: 'absolute',
left: 40,
top: 508,
width: 160,
height: 20,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'left',
},
label23: {
position: 'absolute',
left: 200,
top: 508,
width: 132,
height: 20,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'right',
},
label24: {
position: 'absolute',
left: 338,
top: 508,
width: 16,
height: 20,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'center',
},
ruleThree: {
position: 'absolute',
left: 40,
top: 543,
width: 326,
height: 1,
borderRadius: 0,
backgroundColor: '#EDEAE0',
},
label26: {
position: 'absolute',
left: 40,
top: 560,
width: 160,
height: 20,
color: '#17171A',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'left',
},
label27: {
position: 'absolute',
left: 200,
top: 560,
width: 132,
height: 20,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'right',
},
group4: {
position: 'absolute',
left: 24,
top: 628,
width: 342,
height: 52,
},
signOut: {
position: 'absolute',
left: 0,
top: 0,
width: 342,
height: 52,
borderRadius: 16,
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#E4E1D8',
},
signOutLabel: {
position: 'absolute',
left: 0,
top: 0,
width: 342,
height: 52,
justifyContent: 'center',
},
signOutLabelText: {
color: '#D93B3B',
fontFamily: 'Inter',
fontSize: 16,
lineHeight: 21,
textAlign: 'center',
fontWeight: '600',
},
label30: {
position: 'absolute',
left: 24,
top: 700,
width: 342,
height: 18,
color: '#5B5B63',
fontFamily: 'Inter',
fontSize: 13,
lineHeight: 18,
textAlign: 'center',
},
pressed: {
opacity: 0.6,
},
});SwiftUI
The section labels use .tracking(1) for their letter spacing, and each toggle is a Button wrapping the pill and the knob, with the knob's small shadow applied to the circle only.
import SwiftUI
struct Settings: View {
private func togglePush() {}
private func toggleDigest() {}
private func toggleSound() {}
private func handleSignOut() {}
var body: some View {
ZStack(alignment: .topLeading) {
Color(red: 0.96, green: 0.96, blue: 0.93)
.frame(width: 390, height: 844)
Text("Settings")
.font(.custom("Inter", size: 34))
.fontWeight(.bold)
.lineSpacing(10.2)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 342, height: 44, alignment: .topLeading)
.position(x: 195, y: 94)
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 1, green: 1, blue: 1))
.overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(Color(red: 0.89, green: 0.88, blue: 0.85), lineWidth: 1))
.frame(width: 342, height: 88)
.position(x: 195, y: 180)
Circle()
.fill(Color(red: 0.16, green: 0.31, blue: 0.85))
.frame(width: 56, height: 56)
.position(x: 68, y: 180)
Text("AK")
.font(.custom("Inter", size: 20))
.fontWeight(.semibold)
.lineSpacing(6)
.foregroundColor(Color(red: 1, green: 1, blue: 1))
.multilineTextAlignment(.center)
.frame(width: 56, height: 56, alignment: .center)
.position(x: 68, y: 180)
Text("Ada King")
.font(.custom("Inter", size: 17))
.fontWeight(.semibold)
.lineSpacing(5.1)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 230, height: 24, alignment: .topLeading)
.position(x: 227, y: 172)
Text("[email protected]")
.font(.custom("Inter", size: 14))
.lineSpacing(4.2)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.leading)
.frame(width: 230, height: 20, alignment: .topLeading)
.position(x: 227, y: 196)
Text("NOTIFICATIONS")
.font(.custom("Inter", size: 12))
.fontWeight(.semibold)
.tracking(1)
.lineSpacing(3.6)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.leading)
.frame(width: 342, height: 16, alignment: .topLeading)
.position(x: 195, y: 264)
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 1, green: 1, blue: 1))
.overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(Color(red: 0.89, green: 0.88, blue: 0.85), lineWidth: 1))
.frame(width: 342, height: 156)
.position(x: 195, y: 358)
Text("Push notifications")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 240, height: 20, alignment: .topLeading)
.position(x: 160, y: 306)
RoundedRectangle(cornerRadius: 0)
.fill(Color(red: 0.93, green: 0.92, blue: 0.88))
.frame(width: 326, height: 1)
.position(x: 203, y: 331.5)
Text("Email digest")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 240, height: 20, alignment: .topLeading)
.position(x: 160, y: 358)
RoundedRectangle(cornerRadius: 0)
.fill(Color(red: 0.93, green: 0.92, blue: 0.88))
.frame(width: 326, height: 1)
.position(x: 203, y: 383.5)
Text("Sound")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 240, height: 20, alignment: .topLeading)
.position(x: 160, y: 410)
Button(action: togglePush) {
ZStack(alignment: .topLeading) {
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 0.16, green: 0.31, blue: 0.85))
.frame(width: 51, height: 31)
.position(x: 25.5, y: 15.5)
Circle()
.fill(Color(red: 1, green: 1, blue: 1))
.frame(width: 27, height: 27)
.shadow(color: Color(red: 0, green: 0, blue: 0), radius: 3, x: 0, y: 1)
.position(x: 35.5, y: 15.5)
}
.frame(width: 51, height: 31)
}
.buttonStyle(PressStyle())
.position(x: 331.5, y: 306.5)
Button(action: toggleDigest) {
ZStack(alignment: .topLeading) {
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 0.16, green: 0.31, blue: 0.85))
.frame(width: 51, height: 31)
.position(x: 25.5, y: 15.5)
Circle()
.fill(Color(red: 1, green: 1, blue: 1))
.frame(width: 27, height: 27)
.shadow(color: Color(red: 0, green: 0, blue: 0), radius: 3, x: 0, y: 1)
.position(x: 35.5, y: 15.5)
}
.frame(width: 51, height: 31)
}
.buttonStyle(PressStyle())
.position(x: 331.5, y: 358.5)
Button(action: toggleSound) {
ZStack(alignment: .topLeading) {
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 0.84, green: 0.83, blue: 0.78))
.frame(width: 51, height: 31)
.position(x: 25.5, y: 15.5)
Circle()
.fill(Color(red: 1, green: 1, blue: 1))
.frame(width: 27, height: 27)
.shadow(color: Color(red: 0, green: 0, blue: 0), radius: 3, x: 0, y: 1)
.position(x: 15.5, y: 15.5)
}
.frame(width: 51, height: 31)
}
.buttonStyle(PressStyle())
.position(x: 331.5, y: 410.5)
Text("GENERAL")
.font(.custom("Inter", size: 12))
.fontWeight(.semibold)
.tracking(1)
.lineSpacing(3.6)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.leading)
.frame(width: 342, height: 16, alignment: .topLeading)
.position(x: 195, y: 476)
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 1, green: 1, blue: 1))
.overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(Color(red: 0.89, green: 0.88, blue: 0.85), lineWidth: 1))
.frame(width: 342, height: 104)
.position(x: 195, y: 544)
Text("Language")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 160, height: 20, alignment: .topLeading)
.position(x: 120, y: 518)
Text("English")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.trailing)
.frame(width: 132, height: 20, alignment: .topLeading)
.position(x: 266, y: 518)
Text("›")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.center)
.frame(width: 16, height: 20, alignment: .topLeading)
.position(x: 346, y: 518)
RoundedRectangle(cornerRadius: 0)
.fill(Color(red: 0.93, green: 0.92, blue: 0.88))
.frame(width: 326, height: 1)
.position(x: 203, y: 543.5)
Text("Storage")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.09, green: 0.09, blue: 0.1))
.multilineTextAlignment(.leading)
.frame(width: 160, height: 20, alignment: .topLeading)
.position(x: 120, y: 570)
Text("1.2 GB")
.font(.custom("Inter", size: 16))
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.trailing)
.frame(width: 132, height: 20, alignment: .topLeading)
.position(x: 266, y: 570)
Button(action: handleSignOut) {
ZStack(alignment: .topLeading) {
RoundedRectangle(cornerRadius: 16)
.fill(Color(red: 1, green: 1, blue: 1))
.overlay(RoundedRectangle(cornerRadius: 16).strokeBorder(Color(red: 0.89, green: 0.88, blue: 0.85), lineWidth: 1))
.frame(width: 342, height: 52)
.position(x: 171, y: 26)
Text("Sign out")
.font(.custom("Inter", size: 16))
.fontWeight(.semibold)
.lineSpacing(4.8)
.foregroundColor(Color(red: 0.85, green: 0.23, blue: 0.23))
.multilineTextAlignment(.center)
.frame(width: 342, height: 52, alignment: .center)
.position(x: 171, y: 26)
}
.frame(width: 342, height: 52)
}
.buttonStyle(PressStyle())
.position(x: 195, y: 654)
Text("Version 2.4.1")
.font(.custom("Inter", size: 13))
.lineSpacing(5.2)
.foregroundColor(Color(red: 0.36, green: 0.36, blue: 0.39))
.multilineTextAlignment(.center)
.frame(width: 342, height: 18, alignment: .topLeading)
.position(x: 195, y: 709)
}
.frame(width: 390, height: 844)
}
}
struct PressStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label.opacity(configuration.isPressed ? 0.6 : 1)
}
}Flutter
Each toggle is a generated _Pressable holding the pill and the knob as positioned children, and the rows are plain Text widgets at their coordinates, so changing a row's y is a one-number edit.
import 'package:flutter/material.dart';
class Settings extends StatelessWidget {
const Settings({super.key});
void togglePush() {}
void toggleDigest() {}
void toggleSound() {}
void handleSignOut() {}
@override
Widget build(BuildContext context) {
return SizedBox(
width: 390,
height: 844,
child: Stack(
children: [
Positioned.fill(child: Container(color: Color(0xFFF6F4EE))),
Positioned(
left: 24,
top: 72,
child: SizedBox(
width: 342,
height: 44,
child: Text(
'Settings',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 34,
color: Color(0xFF17171A),
height: 1.3,
fontWeight: FontWeight.w700,
),
),
),
),
Positioned(
left: 24,
top: 136,
child: Container(
width: 342,
height: 88,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Color(0xFFE4E1D8), width: 1),
),
),
),
Positioned(
left: 40,
top: 152,
child: Container(
width: 56,
height: 56,
decoration: BoxDecoration(
color: Color(0xFF2A50D8),
shape: BoxShape.circle,
),
),
),
Positioned(
left: 40,
top: 152,
child: SizedBox(
width: 56,
height: 56,
child: Align(
alignment: Alignment.center,
child: Text(
'AK',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 20,
color: Color(0xFFFFFFFF),
height: 1.3,
fontWeight: FontWeight.w600,
),
),
),
),
),
Positioned(
left: 112,
top: 160,
child: SizedBox(
width: 230,
height: 24,
child: Text(
'Ada King',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 17,
color: Color(0xFF17171A),
height: 1.3,
fontWeight: FontWeight.w600,
),
),
),
),
Positioned(
left: 112,
top: 186,
child: SizedBox(
width: 230,
height: 20,
child: Text(
'[email protected]',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 14,
color: Color(0xFF5B5B63),
height: 1.3,
),
),
),
),
Positioned(
left: 24,
top: 256,
child: SizedBox(
width: 342,
height: 16,
child: Text(
'NOTIFICATIONS',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 12,
color: Color(0xFF5B5B63),
height: 1.3,
fontWeight: FontWeight.w600,
letterSpacing: 1,
),
),
),
),
Positioned(
left: 24,
top: 280,
child: Container(
width: 342,
height: 156,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Color(0xFFE4E1D8), width: 1),
),
),
),
Positioned(
left: 40,
top: 296,
child: SizedBox(
width: 240,
height: 20,
child: Text(
'Push notifications',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF17171A),
height: 1.3,
),
),
),
),
Positioned(
left: 40,
top: 331,
child: Container(
width: 326,
height: 1,
decoration: BoxDecoration(color: Color(0xFFEDEAE0)),
),
),
Positioned(
left: 40,
top: 348,
child: SizedBox(
width: 240,
height: 20,
child: Text(
'Email digest',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF17171A),
height: 1.3,
),
),
),
),
Positioned(
left: 40,
top: 383,
child: Container(
width: 326,
height: 1,
decoration: BoxDecoration(color: Color(0xFFEDEAE0)),
),
),
Positioned(
left: 40,
top: 400,
child: SizedBox(
width: 240,
height: 20,
child: Text(
'Sound',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF17171A),
height: 1.3,
),
),
),
),
Positioned(
left: 306,
top: 291,
child: _Pressable(
onTap: togglePush,
child: SizedBox(
width: 51,
height: 31,
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
child: Container(
width: 51,
height: 31,
decoration: BoxDecoration(
color: Color(0xFF2A50D8),
borderRadius: BorderRadius.circular(16),
),
),
),
Positioned(
left: 22,
top: 2,
child: Container(
width: 27,
height: 27,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Color(0xFF000000),
blurRadius: 3,
offset: Offset(0, 1),
),
],
),
),
),
],
),
),
),
),
Positioned(
left: 306,
top: 343,
child: _Pressable(
onTap: toggleDigest,
child: SizedBox(
width: 51,
height: 31,
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
child: Container(
width: 51,
height: 31,
decoration: BoxDecoration(
color: Color(0xFF2A50D8),
borderRadius: BorderRadius.circular(16),
),
),
),
Positioned(
left: 22,
top: 2,
child: Container(
width: 27,
height: 27,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Color(0xFF000000),
blurRadius: 3,
offset: Offset(0, 1),
),
],
),
),
),
],
),
),
),
),
Positioned(
left: 306,
top: 395,
child: _Pressable(
onTap: toggleSound,
child: SizedBox(
width: 51,
height: 31,
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
child: Container(
width: 51,
height: 31,
decoration: BoxDecoration(
color: Color(0xFFD7D3C8),
borderRadius: BorderRadius.circular(16),
),
),
),
Positioned(
left: 2,
top: 2,
child: Container(
width: 27,
height: 27,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Color(0xFF000000),
blurRadius: 3,
offset: Offset(0, 1),
),
],
),
),
),
],
),
),
),
),
Positioned(
left: 24,
top: 468,
child: SizedBox(
width: 342,
height: 16,
child: Text(
'GENERAL',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 12,
color: Color(0xFF5B5B63),
height: 1.3,
fontWeight: FontWeight.w600,
letterSpacing: 1,
),
),
),
),
Positioned(
left: 24,
top: 492,
child: Container(
width: 342,
height: 104,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Color(0xFFE4E1D8), width: 1),
),
),
),
Positioned(
left: 40,
top: 508,
child: SizedBox(
width: 160,
height: 20,
child: Text(
'Language',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF17171A),
height: 1.3,
),
),
),
),
Positioned(
left: 200,
top: 508,
child: SizedBox(
width: 132,
height: 20,
child: Text(
'English',
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF5B5B63),
height: 1.3,
),
),
),
),
Positioned(
left: 338,
top: 508,
child: SizedBox(
width: 16,
height: 20,
child: Text(
'›',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF5B5B63),
height: 1.3,
),
),
),
),
Positioned(
left: 40,
top: 543,
child: Container(
width: 326,
height: 1,
decoration: BoxDecoration(color: Color(0xFFEDEAE0)),
),
),
Positioned(
left: 40,
top: 560,
child: SizedBox(
width: 160,
height: 20,
child: Text(
'Storage',
textAlign: TextAlign.left,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF17171A),
height: 1.3,
),
),
),
),
Positioned(
left: 200,
top: 560,
child: SizedBox(
width: 132,
height: 20,
child: Text(
'1.2 GB',
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFF5B5B63),
height: 1.3,
),
),
),
),
Positioned(
left: 24,
top: 628,
child: _Pressable(
onTap: handleSignOut,
child: SizedBox(
width: 342,
height: 52,
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
child: Container(
width: 342,
height: 52,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: Color(0xFFE4E1D8), width: 1),
),
),
),
Positioned(
left: 0,
top: 0,
child: SizedBox(
width: 342,
height: 52,
child: Align(
alignment: Alignment.center,
child: Text(
'Sign out',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 16,
color: Color(0xFFD93B3B),
height: 1.3,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
),
),
),
),
Positioned(
left: 24,
top: 700,
child: SizedBox(
width: 342,
height: 18,
child: Text(
'Version 2.4.1',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 13,
color: Color(0xFF5B5B63),
height: 1.4,
),
),
),
),
],
),
);
}
}
class _Pressable extends StatefulWidget {
final VoidCallback onTap;
final Widget child;
const _Pressable({required this.onTap, required this.child});
@override
State<_Pressable> createState() => _PressableState();
}
class _PressableState extends State<_Pressable> {
bool _pressed = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: widget.onTap,
onTapDown: (_) => setState(() => _pressed = true),
onTapUp: (_) => setState(() => _pressed = false),
onTapCancel: () => setState(() => _pressed = false),
child: Opacity(opacity: _pressed ? 0.6 : 1.0, child: widget.child),
);
}
}HTML and CSS
Each toggle is a button holding two positioned divs, and every row label is a div at an absolute position. The handlers are stubs in a script block at the end.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Settings</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet" />
<style>
html, body {
margin: 0;
padding: 0;
background: #F6F4EE;
}
.screen {
position: relative;
width: 390px;
height: 844px;
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: none;
background: #F6F4EE;
}
.screen::-webkit-scrollbar {
display: none;
}
.title {
position: absolute;
left: 24px;
top: 72px;
width: 342px;
height: 44px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 34px;
font-weight: 700;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.card2 {
position: absolute;
left: 24px;
top: 136px;
width: 342px;
height: 88px;
background: #ffffff;
border-radius: 16px;
border: 1px solid #E4E1D8;
box-sizing: border-box;
}
.avatar {
position: absolute;
left: 40px;
top: 152px;
width: 56px;
height: 56px;
background: #2A50D8;
border-radius: 50%;
}
.initials {
position: absolute;
left: 40px;
top: 152px;
width: 56px;
height: 56px;
color: #ffffff;
font-family: 'Inter', sans-serif;
font-size: 20px;
font-weight: 600;
text-align: center;
line-height: 1.3;
white-space: pre-wrap;
display: flex;
flex-direction: column;
justify-content: center;
}
.label5 {
position: absolute;
left: 112px;
top: 160px;
width: 230px;
height: 24px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 17px;
font-weight: 600;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.label6 {
position: absolute;
left: 112px;
top: 186px;
width: 230px;
height: 20px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 14px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.label7 {
position: absolute;
left: 24px;
top: 256px;
width: 342px;
height: 16px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 12px;
font-weight: 600;
text-align: left;
line-height: 1.3;
letter-spacing: 1px;
white-space: pre-wrap;
}
.card8 {
position: absolute;
left: 24px;
top: 280px;
width: 342px;
height: 156px;
background: #ffffff;
border-radius: 16px;
border: 1px solid #E4E1D8;
box-sizing: border-box;
}
.label9 {
position: absolute;
left: 40px;
top: 296px;
width: 240px;
height: 20px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.ruleOne {
position: absolute;
left: 40px;
top: 331px;
width: 326px;
height: 1px;
background: #EDEAE0;
}
.label11 {
position: absolute;
left: 40px;
top: 348px;
width: 240px;
height: 20px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.ruleTwo {
position: absolute;
left: 40px;
top: 383px;
width: 326px;
height: 1px;
background: #EDEAE0;
}
.label13 {
position: absolute;
left: 40px;
top: 400px;
width: 240px;
height: 20px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.group {
position: absolute;
left: 306px;
top: 291px;
width: 51px;
height: 31px;
cursor: pointer;
}
.pushSwitch {
position: absolute;
left: 0px;
top: 0px;
width: 51px;
height: 31px;
background: #2A50D8;
border-radius: 16px;
}
.pushKnob {
position: absolute;
left: 22px;
top: 2px;
width: 27px;
height: 27px;
background: #ffffff;
border-radius: 50%;
filter: drop-shadow(0px 1px 3px #000000);
}
.group2 {
position: absolute;
left: 306px;
top: 343px;
width: 51px;
height: 31px;
cursor: pointer;
}
.digestSwitch {
position: absolute;
left: 0px;
top: 0px;
width: 51px;
height: 31px;
background: #2A50D8;
border-radius: 16px;
}
.digestKnob {
position: absolute;
left: 22px;
top: 2px;
width: 27px;
height: 27px;
background: #ffffff;
border-radius: 50%;
filter: drop-shadow(0px 1px 3px #000000);
}
.group3 {
position: absolute;
left: 306px;
top: 395px;
width: 51px;
height: 31px;
cursor: pointer;
}
.soundSwitch {
position: absolute;
left: 0px;
top: 0px;
width: 51px;
height: 31px;
background: #D7D3C8;
border-radius: 16px;
}
.soundKnob {
position: absolute;
left: 2px;
top: 2px;
width: 27px;
height: 27px;
background: #ffffff;
border-radius: 50%;
filter: drop-shadow(0px 1px 3px #000000);
}
.label20 {
position: absolute;
left: 24px;
top: 468px;
width: 342px;
height: 16px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 12px;
font-weight: 600;
text-align: left;
line-height: 1.3;
letter-spacing: 1px;
white-space: pre-wrap;
}
.card21 {
position: absolute;
left: 24px;
top: 492px;
width: 342px;
height: 104px;
background: #ffffff;
border-radius: 16px;
border: 1px solid #E4E1D8;
box-sizing: border-box;
}
.label22 {
position: absolute;
left: 40px;
top: 508px;
width: 160px;
height: 20px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.label23 {
position: absolute;
left: 200px;
top: 508px;
width: 132px;
height: 20px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: right;
line-height: 1.3;
white-space: pre-wrap;
}
.label24 {
position: absolute;
left: 338px;
top: 508px;
width: 16px;
height: 20px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: center;
line-height: 1.3;
white-space: pre-wrap;
}
.ruleThree {
position: absolute;
left: 40px;
top: 543px;
width: 326px;
height: 1px;
background: #EDEAE0;
}
.label26 {
position: absolute;
left: 40px;
top: 560px;
width: 160px;
height: 20px;
color: #17171A;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: left;
line-height: 1.3;
white-space: pre-wrap;
}
.label27 {
position: absolute;
left: 200px;
top: 560px;
width: 132px;
height: 20px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 16px;
text-align: right;
line-height: 1.3;
white-space: pre-wrap;
}
.group4 {
position: absolute;
left: 24px;
top: 628px;
width: 342px;
height: 52px;
cursor: pointer;
}
.signOut {
position: absolute;
left: 0px;
top: 0px;
width: 342px;
height: 52px;
background: #ffffff;
border-radius: 16px;
border: 1px solid #E4E1D8;
box-sizing: border-box;
}
.signOutLabel {
position: absolute;
left: 0px;
top: 0px;
width: 342px;
height: 52px;
color: #D93B3B;
font-family: 'Inter', sans-serif;
font-size: 16px;
font-weight: 600;
text-align: center;
line-height: 1.3;
white-space: pre-wrap;
display: flex;
flex-direction: column;
justify-content: center;
}
.label30 {
position: absolute;
left: 24px;
top: 700px;
width: 342px;
height: 18px;
color: #5B5B63;
font-family: 'Inter', sans-serif;
font-size: 13px;
text-align: center;
line-height: 1.4;
white-space: pre-wrap;
}
.tappable {
appearance: none;
border: none;
padding: 0;
background: transparent;
font: inherit;
color: inherit;
text-align: inherit;
}
.tappable:active {
opacity: 0.6;
}
</style>
</head>
<body>
<div class="screen">
<div class="title">Settings</div>
<div class="card2"></div>
<div class="avatar"></div>
<div class="initials">AK</div>
<div class="label5">Ada King</div>
<div class="label6">[email protected]</div>
<div class="label7">NOTIFICATIONS</div>
<div class="card8"></div>
<div class="label9">Push notifications</div>
<div class="ruleOne"></div>
<div class="label11">Email digest</div>
<div class="ruleTwo"></div>
<div class="label13">Sound</div>
<button type="button" class="tappable group" onclick="togglePush()">
<div class="pushSwitch"></div>
<div class="pushKnob"></div>
</button>
<button type="button" class="tappable group2" onclick="toggleDigest()">
<div class="digestSwitch"></div>
<div class="digestKnob"></div>
</button>
<button type="button" class="tappable group3" onclick="toggleSound()">
<div class="soundSwitch"></div>
<div class="soundKnob"></div>
</button>
<div class="label20">GENERAL</div>
<div class="card21"></div>
<div class="label22">Language</div>
<div class="label23">English</div>
<div class="label24">›</div>
<div class="ruleThree"></div>
<div class="label26">Storage</div>
<div class="label27">1.2 GB</div>
<button type="button" class="tappable group4" onclick="handleSignOut()">
<div class="signOut"></div>
<div class="signOutLabel">Sign out</div>
</button>
<div class="label30">Version 2.4.1</div>
</div>
<script>
function togglePush() {}
function toggleDigest() {}
function toggleSound() {}
function handleSignOut() {}
</script>
</body>
</html>What this does not do
- These are drawn toggles, not platform switches. A pill and a knob look like a switch, but they are rectangles and a circle inside a button. They do not expose an on/off state to a screen reader and do not animate. In your project, swap them for your platform's own switch (
Switch,Toggle, a checkbox input) positioned at the same coordinates. - State is yours. The on and off positions here are just where the knobs were drawn. The handlers are empty, and nothing flips when you tap.
- Rows do not reflow. If you add a row, every element below it needs to move down. The positions are literal, which is also why each one can be read straight off the canvas.
- Disclosure arrows are text. The arrow after "English" is a text character, not a platform chevron.
- Fixed size and fonts by name. 390 by 844, and
Interis not embedded.
Make your own
Open the editor, change any number, and the four files above change with it. What you can build lists every control and property the canvas supports, limits included.