im so tired man

This commit is contained in:
Wowieee4
2026-05-28 11:27:06 +07:00
parent 66da2473e1
commit 6272ece15d
86 changed files with 1759 additions and 4090 deletions
@@ -0,0 +1,3 @@
Server connect application layer.
This layer is reserved for connection testing and save-server-url state orchestration.
@@ -0,0 +1,3 @@
Server connect data layer.
This layer is reserved for ping data sources and local server URL persistence adapters.
@@ -0,0 +1,3 @@
Server connect domain layer.
This layer is reserved for server info entities and connection use cases.
@@ -0,0 +1,3 @@
Server connect presentation layer.
This layer is reserved for first-run connection pages and widgets.
@@ -37,6 +37,7 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
await runFriendlyAction(
() async {
final clean = AppConstants.normalizeServerUrl(_url.text);
await sl<ApiClient>().init(clean);
final res = await Dio(BaseOptions(
connectTimeout: AppConstants.pingTimeout,
receiveTimeout: AppConstants.pingTimeout,
@@ -47,7 +48,8 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
: 'Server merespons, tetapi format ping tidak valid.';
},
onError: (message) => _message = message,
fallback: 'Tidak bisa terhubung. Periksa URL dan jaringan.',
fallback:
'Tidak bisa terhubung. Untuk HP via USB, jalankan adb reverse tcp:8080 tcp:8080 lalu pakai http://127.0.0.1:8080.',
);
if (mounted) setState(() => _loading = false);
}
@@ -60,6 +62,8 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
}
void _useUsbUrl() => setState(() => _url.text = 'http://127.0.0.1:8080');
void _useAndroidEmulatorUrl() =>
setState(() => _url.text = 'http://10.0.2.2:8080');
@override
Widget build(BuildContext context) {
@@ -96,12 +100,23 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
SafeArea(
child: LayoutBuilder(
builder: (context, constraints) {
final compact = constraints.maxWidth < 390;
final compact =
constraints.maxWidth < 480 || constraints.maxHeight < 720;
final horizontalPadding =
constraints.maxWidth < 480 ? 12.0 : 20.0;
return SingleChildScrollView(
padding: EdgeInsets.fromLTRB(20, compact ? 20 : 36, 20, 24),
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
padding: EdgeInsets.fromLTRB(
horizontalPadding,
compact ? 10 : 32,
horizontalPadding,
20 + MediaQuery.of(context).viewInsets.bottom,
),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 460),
constraints:
BoxConstraints(maxWidth: compact ? 380 : 520),
child: TweenAnimationBuilder<double>(
tween: Tween(begin: 18, end: 0),
duration: const Duration(milliseconds: 520),
@@ -114,7 +129,8 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
child: Container(
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.96),
borderRadius: BorderRadius.circular(28),
borderRadius:
BorderRadius.circular(compact ? 22 : 28),
border: Border.all(
color: Colors.white.withValues(alpha: 0.7)),
boxShadow: [
@@ -126,13 +142,18 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(28),
borderRadius:
BorderRadius.circular(compact ? 22 : 28),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
padding:
const EdgeInsets.fromLTRB(22, 22, 22, 20),
padding: EdgeInsets.fromLTRB(
compact ? 14 : 22,
compact ? 14 : 22,
compact ? 14 : 22,
compact ? 14 : 20,
),
decoration: const BoxDecoration(
color: Color(0xFF071226),
),
@@ -143,37 +164,38 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
Row(
children: [
Container(
width: 48,
height: 48,
width: compact ? 38 : 48,
height: compact ? 38 : 48,
decoration: BoxDecoration(
color: const Color(0xFF2563EB),
borderRadius:
BorderRadius.circular(16),
),
child: const Icon(
Icons.navigation_rounded,
color: Colors.white,
size: 28),
child: Icon(
Icons.navigation_rounded,
color: Colors.white,
size: compact ? 24 : 28,
),
),
const SizedBox(width: 12),
const Expanded(
Expanded(
child: Text(
'WalkGuide Link',
'WalkGuide',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontSize: compact ? 16 : 20,
fontWeight: FontWeight.w900,
),
),
),
],
),
const SizedBox(height: 18),
const Text(
SizedBox(height: compact ? 14 : 18),
Text(
'Connect to Server',
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontSize: compact ? 22 : 30,
fontWeight: FontWeight.w900,
height: 1,
),
@@ -191,7 +213,7 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
),
),
Padding(
padding: const EdgeInsets.all(22),
padding: EdgeInsets.all(compact ? 14 : 22),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
@@ -217,13 +239,18 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
label: 'USB: 127.0.0.1',
onTap: _useUsbUrl,
),
_HintChip(
icon: Icons.phone_android_outlined,
label: 'Emulator: 10.0.2.2',
onTap: _useAndroidEmulatorUrl,
),
const _HintChip(
icon: Icons.wifi_tethering_outlined,
label: 'Wi-Fi: IP laptop',
),
],
),
const SizedBox(height: 16),
SizedBox(height: compact ? 12 : 16),
OutlinedButton.icon(
onPressed: _loading ? null : _test,
icon: _loading
@@ -251,15 +278,17 @@ class _ServerConnectScreenState extends State<ServerConnectScreen> {
label: const Text('Continue'),
),
],
const SizedBox(height: 18),
const Center(
child: Text(
'v1.0.0 | Spring Boot + Flutter',
style: TextStyle(
fontSize: 11,
color: Color(0xFF94A3B8)),
if (!compact) ...[
const SizedBox(height: 18),
const Center(
child: Text(
'v1.0.0 | Spring Boot + Flutter',
style: TextStyle(
fontSize: 11,
color: Color(0xFF94A3B8)),
),
),
),
],
],
),
),