privacy_settings_view.dart 2.36 KB
import 'package:doublefeel_flutter/core/theme/app_colors.dart';
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
import 'package:doublefeel_flutter/r.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../controllers/privacy_settings_controller.dart';

class PrivacySettingsView extends GetView<PrivacySettingsController> {
  const PrivacySettingsView({super.key});

  static const _background = Color(0xFFF5F2FF);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: _background,
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        toolbarHeight: 44.dp,
        centerTitle: true,
        title: Text(
          "隐私设置",
          style: TextStyle(
            fontSize: 16,
            color: Color(0xFF000000),
            fontWeight: FontWeight.w500,
          ),
        ),
        leading: IconButton(
          highlightColor: Colors.transparent,
          padding: EdgeInsets.zero,
          onPressed: () {
            controller.executeBackLogic();
          },
          icon: Image(
            width: 24.w,
            height: 24.w,
            alignment: Alignment.centerLeft,
            image: AssetImage(R.assetsImagesNavBackIcon),
          ),
        ),
      ),
      body: PopScope(canPop: false, child: _buildContentView(context)),
    );
  }

  Widget _buildContentView(BuildContext context) {
    return SizedBox(
      width: double.infinity,
      height: double.infinity,
      child: Column(
        children: [
          SizedBox(height: 16.dp),
          noAddByIdView(),
        ],
      ),
    );
  }

  Widget noAddByIdView() {
    return Container(
      width: double.infinity,
      height: 48.dp,
      margin: EdgeInsets.symmetric(horizontal: 16.dp),
      padding: EdgeInsets.symmetric(horizontal: 20.dp),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(16.dp),
      ),
      child: Row(
        children: [
          Text(
            "不允许通过ID添加我",
            style: TextStyle(
              fontSize: 14,
              color: AppColors.textPrimary,
            ),
          ),
          Spacer(),
          Switch(
            value: true,
            inactiveTrackColor: Color(0xFF845EEE),
            onChanged: (value) {},
          )
        ],
      ),
    );
  }
}