Files
tripz-llc/apps/rider/lib/features/home/view/home_screen.dart
T
HamzaandClaude Opus 4.8 6116d23d0c flutter(rider): rebuild lib on Cubit/Bloc + Tripz backend (core + auth slice)
- keep store identity (com.mobileapp.store.ride, shorebird, firebase, fonts); old lib -> lib_old_getx
- core: config/di/router(go_router)/theme/api_client(dio+tenant+bearer)/token_store(secure)
- auth: repo + AuthCubit + OTP phone/otp screens; home: flutter_map (OSM placeholder, انطلق TODO)
- android usesCleartextTraffic=true for http API; maps=flutter_map (no Google), state=Cubit

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 20:47:55 +03:00

78 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import '../../auth/cubit/auth_cubit.dart';
import '../../auth/cubit/auth_state.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
final center = const LatLng(31.9539, 35.9106); // عمّان
return Scaffold(
appBar: AppBar(
title: const Text('Tripz'),
actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () => context.read<AuthCubit>().logout(),
),
],
),
body: Stack(
children: [
FlutterMap(
options: MapOptions(initialCenter: center, initialZoom: 13),
children: [
// TODO: استبدال بلاطات انطلق (Martin) بدل OSM
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.mobileapp.store.ride',
),
MarkerLayer(markers: [
Marker(
point: center,
width: 40,
height: 40,
child: const Icon(Icons.location_pin, color: Colors.red, size: 40),
),
]),
],
),
Positioned(
left: 16,
right: 16,
bottom: 24,
child: Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: BlocBuilder<AuthCubit, AuthState>(
builder: (context, state) {
final name = state.user?.name ?? state.user?.phone ?? '';
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('مرحباً $name',
style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 12),
FilledButton.icon(
onPressed: () {},
icon: const Icon(Icons.local_taxi),
label: const Text('اطلب رحلة (قريباً)'),
),
],
);
},
),
),
),
),
],
),
);
}
}