227 lines
8.1 KiB
Dart
227 lines
8.1 KiB
Dart
import 'package:flutter/material.dart';
|
||
import '../../core/constants/app_colors.dart';
|
||
import '../../core/constants/app_text_styles.dart';
|
||
import '../widgets/teacher_panel_scaffold.dart';
|
||
import 'course_page.dart';
|
||
import 'dashboard_page.dart';
|
||
import 'license_page.dart';
|
||
import 'ticket_page.dart';
|
||
import 'transaction_page.dart';
|
||
|
||
class LicenseBuilderPage extends StatefulWidget {
|
||
const LicenseBuilderPage({super.key});
|
||
|
||
@override
|
||
State<LicenseBuilderPage> createState() => _LicenseBuilderPageState();
|
||
}
|
||
|
||
class _LicenseBuilderPageState extends State<LicenseBuilderPage> {
|
||
String _position = 'بالا راست';
|
||
final TextEditingController _offsetController = TextEditingController(text: '۳۰');
|
||
final TextEditingController _paddingController = TextEditingController(text: '۴۸');
|
||
|
||
final List<String> _positions = const [
|
||
'بالا راست',
|
||
'بالا وسط',
|
||
'بالا چپ',
|
||
'وسط راست',
|
||
'وسط',
|
||
'وسط چپ',
|
||
'پایین راست',
|
||
'پایین وسط',
|
||
'پایین چپ',
|
||
];
|
||
|
||
@override
|
||
void dispose() {
|
||
_offsetController.dispose();
|
||
_paddingController.dispose();
|
||
super.dispose();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final isDesktop = MediaQuery.of(context).size.width > 900;
|
||
|
||
return TeacherPanelScaffold(
|
||
selectedMenu: PanelMenu.license,
|
||
onDashboardTap: () {
|
||
Navigator.of(context).pushReplacement(
|
||
MaterialPageRoute(builder: (context) => const DashboardPage()),
|
||
);
|
||
},
|
||
onCourseTap: () {
|
||
Navigator.of(context).pushReplacement(
|
||
MaterialPageRoute(builder: (context) => const CoursePage()),
|
||
);
|
||
},
|
||
onLicenseTap: () {
|
||
Navigator.of(context).pushReplacement(
|
||
MaterialPageRoute(builder: (context) => const PanelLicensePage()),
|
||
);
|
||
},
|
||
onTransactionTap: () {
|
||
Navigator.of(context).push(
|
||
MaterialPageRoute(builder: (context) => const TransactionPage()),
|
||
);
|
||
},
|
||
onTicketTap: () {
|
||
Navigator.of(context).push(
|
||
MaterialPageRoute(builder: (context) => const TicketPage()),
|
||
);
|
||
},
|
||
child: SingleChildScrollView(
|
||
padding: EdgeInsets.all(isDesktop ? 24 : 12),
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
color: Colors.white.withValues(alpha: 0.35),
|
||
borderRadius: BorderRadius.circular(10),
|
||
),
|
||
padding: EdgeInsets.all(isDesktop ? 18 : 12),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
InkWell(
|
||
onTap: () => Navigator.pop(context),
|
||
child: const Icon(Icons.arrow_back, color: AppColors.sidebarBg),
|
||
),
|
||
const SizedBox(height: 10),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.end,
|
||
children: [
|
||
const Icon(Icons.settings, size: 18, color: AppColors.sidebarBg),
|
||
const SizedBox(width: 6),
|
||
Text(
|
||
'تنظیمات پیش فرض لایسنس ها',
|
||
style: AppTextStyles.headlineMedium.copyWith(
|
||
color: AppColors.sidebarBg,
|
||
fontSize: 20,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
const SizedBox(height: 12),
|
||
Container(height: 1, color: Colors.black12),
|
||
const SizedBox(height: 12),
|
||
Text(
|
||
'تنظیمات پیشفرض لایسنس هنگام ساخت لایسنس توسط API در صورت وجود نداشتن استفاده میشود. '
|
||
'همچنین در صفحه لایسنس جدید این تنظیمات به صورت پیشفرض لود میشوند.',
|
||
style: AppTextStyles.bodyMedium,
|
||
),
|
||
const SizedBox(height: 40),
|
||
Align(
|
||
alignment: Alignment.centerRight,
|
||
child: Text('تنظیمات واترمارک', style: AppTextStyles.headlineMedium),
|
||
),
|
||
const SizedBox(height: 18),
|
||
Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
SizedBox(
|
||
width: isDesktop ? 120 : 90,
|
||
child: Padding(
|
||
padding: const EdgeInsets.only(top: 70),
|
||
child: Text('مکان نمایش', style: AppTextStyles.bodyLarge),
|
||
),
|
||
),
|
||
Expanded(
|
||
child: Wrap(
|
||
spacing: 20,
|
||
runSpacing: 8,
|
||
children: _positions.map((item) {
|
||
final selected = _position == item;
|
||
return SizedBox(
|
||
width: isDesktop ? 170 : 130,
|
||
child: InkWell(
|
||
onTap: () => setState(() => _position = item),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Icon(
|
||
selected
|
||
? Icons.radio_button_checked
|
||
: Icons.radio_button_unchecked,
|
||
color: AppColors.sidebarBg,
|
||
),
|
||
const SizedBox(width: 6),
|
||
Text(
|
||
item,
|
||
style: AppTextStyles.bodyLarge.copyWith(
|
||
color: AppColors.sidebarBg,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}).toList(),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
const SizedBox(height: 18),
|
||
_buildLabel('جابه جایی'),
|
||
const SizedBox(height: 6),
|
||
_buildNumberField(_offsetController, 'ثانیه'),
|
||
const SizedBox(height: 6),
|
||
Text(
|
||
'این مقدار تعیین میکند مکان نمایش واترمارک هرچند ثانیه در صفحه تغییر کند.',
|
||
style: AppTextStyles.bodyMedium,
|
||
),
|
||
const SizedBox(height: 14),
|
||
_buildLabel('حاشیه'),
|
||
const SizedBox(height: 6),
|
||
_buildNumberField(_paddingController, 'پیکسل'),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _buildLabel(String text) {
|
||
return Align(
|
||
alignment: Alignment.centerRight,
|
||
child: Text(text, style: AppTextStyles.bodyLarge),
|
||
);
|
||
}
|
||
|
||
Widget _buildNumberField(TextEditingController controller, String unit) {
|
||
return Container(
|
||
height: 40,
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(10),
|
||
border: Border.all(color: AppColors.sidebarBg.withValues(alpha: 0.7)),
|
||
),
|
||
child: Row(
|
||
children: [
|
||
Container(
|
||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||
decoration: BoxDecoration(
|
||
color: Colors.blueGrey.withValues(alpha: 0.2),
|
||
borderRadius: BorderRadius.circular(10),
|
||
),
|
||
child: Text(
|
||
unit,
|
||
style: AppTextStyles.bodyMedium.copyWith(color: AppColors.sidebarBg),
|
||
),
|
||
),
|
||
Expanded(
|
||
child: TextField(
|
||
controller: controller,
|
||
textAlign: TextAlign.right,
|
||
keyboardType: TextInputType.number,
|
||
decoration: const InputDecoration(
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|