import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';
import '../../../components/button/button.dart';
import '../../../router/app_router.gr.dart';
import 'widgets/phone_field.dart';

@RoutePage()
class LoginPage extends StatelessWidget {
  const LoginPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Masuk')),
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 24.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const SizedBox(height: 40),

            // Title
            LoginPhoneField(),

            const SizedBox(height: 50),

            // Continue Button
            AppElevatedButton(
              onPressed: () {
                context.router.push(RegisterRoute());
              },
              title: 'Lanjutkan',
            ),

            const SizedBox(height: 24),

            // Terms and Conditions
            Center(
              child: RichText(
                textAlign: TextAlign.center,
                text: TextSpan(
                  style: AppStyle.md.copyWith(
                    color: AppColor.textSecondary,
                    height: 1.4,
                  ),
                  children: [
                    const TextSpan(
                      text: 'Dengan masuk Enaklo, kamu telah\nmenyetujui ',
                    ),
                    TextSpan(
                      text: 'Syarat & Ketentuan',
                      style: AppStyle.md.copyWith(
                        color: AppColor.primary,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                    const TextSpan(text: ' dan\n'),
                    TextSpan(
                      text: 'Kebijakan Privasi',
                      style: AppStyle.md.copyWith(
                        color: AppColor.primary,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                  ],
                ),
              ),
            ),

            const SizedBox(height: 40),
          ],
        ),
      ),
    );
  }
}
