62 lines
1.6 KiB
Dart
62 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import '../app.dart';
|
|
|
|
const _leftBorderRadius = BorderRadius.only(
|
|
topLeft: Radius.circular(8),
|
|
bottomLeft: Radius.circular(8),
|
|
);
|
|
|
|
const _rightBorderRadius = BorderRadius.only(
|
|
topRight: Radius.circular(8),
|
|
bottomRight: Radius.circular(8),
|
|
);
|
|
|
|
class LangButton extends StatelessWidget {
|
|
final bool isTurkmen;
|
|
final bool isSelected;
|
|
final Function(bool) callback;
|
|
|
|
LangButton({
|
|
required this.isTurkmen,
|
|
required this.isSelected,
|
|
required this.callback,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () => callback(isTurkmen),
|
|
child: Container(
|
|
padding: EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: isSelected ? ThemeColor.mainColor : Colors.white,
|
|
border: Border.all(color: ThemeColor.mainColor),
|
|
borderRadius: isTurkmen ? _leftBorderRadius : _rightBorderRadius,
|
|
),
|
|
width: 0.45.sw,
|
|
child: Row(
|
|
children: [
|
|
Image.asset(
|
|
isTurkmen ? 'assets/flags/tm.png' : 'assets/flags/ru.png',
|
|
height: 20,
|
|
width: 20,
|
|
),
|
|
SizedBox(width: 12),
|
|
Flexible(
|
|
child: Text(
|
|
isTurkmen ? 'Türkmen dili' : 'Русский',
|
|
style: TextStyle(
|
|
color: isSelected ? Colors.white : ThemeColor.mainColor,
|
|
fontSize: 16.sp,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|