125 lines
4.1 KiB
Dart
125 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
/// Widget untuk menampilkan pengaturan akun sumber dan destinasi
|
|
///
|
|
/// Widget ini menampilkan dua dropdown untuk memilih akun sumber dan tujuan.
|
|
class AccountSettingsWidget extends StatelessWidget {
|
|
final String sourceAccount;
|
|
final String destinationAccount;
|
|
final VoidCallback onSelectSource;
|
|
final VoidCallback onSelectDestination;
|
|
|
|
const AccountSettingsWidget({
|
|
super.key,
|
|
required this.sourceAccount,
|
|
required this.destinationAccount,
|
|
required this.onSelectSource,
|
|
required this.onSelectDestination,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Mencoba menggunakan Google Fonts Courier Prime, jika gagal gunakan font sistem
|
|
TextStyle courierPrime;
|
|
try {
|
|
courierPrime = GoogleFonts.courierPrime(
|
|
textStyle: const TextStyle(
|
|
fontSize: 14,
|
|
height: 1.2,
|
|
),
|
|
);
|
|
} catch (e) {
|
|
// Fallback ke font sistem jika Google Fonts tidak tersedia
|
|
courierPrime = const TextStyle(
|
|
fontFamily: 'CourierPrime, Courier, monospace',
|
|
fontSize: 14,
|
|
height: 1.2,
|
|
);
|
|
}
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(8.0),
|
|
color: Colors.white,
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
'Dari:',
|
|
style: courierPrime.copyWith(fontWeight: FontWeight.bold),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: onSelectSource,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey),
|
|
borderRadius: BorderRadius.circular(4.0),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
sourceAccount,
|
|
style: courierPrime,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
const Icon(Icons.arrow_drop_down, size: 16),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
'Ke:',
|
|
style: courierPrime.copyWith(fontWeight: FontWeight.bold),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: onSelectDestination,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey),
|
|
borderRadius: BorderRadius.circular(4.0),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
destinationAccount,
|
|
style: courierPrime,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
const Icon(Icons.arrow_drop_down, size: 16),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|