54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:stacked_services/stacked_services.dart';
|
|
|
|
import 'app.locator.dart';
|
|
import 'enum/snackbar_enum.dart';
|
|
|
|
void setupSnackbarUi() {
|
|
final service = locator<SnackbarService>();
|
|
|
|
service.registerCustomSnackbarConfig(
|
|
variant: SnackbarType.sukses,
|
|
config: SnackbarConfig(
|
|
backgroundColor: Colors.black.withOpacity(.5),
|
|
textColor: Colors.green,
|
|
borderRadius: 50,
|
|
icon: Icon(
|
|
Icons.check,
|
|
color: Colors.green,
|
|
),
|
|
snackPosition: SnackPosition.TOP,
|
|
margin: EdgeInsets.all(10),
|
|
),
|
|
);
|
|
|
|
service.registerCustomSnackbarConfig(
|
|
variant: SnackbarType.gagal,
|
|
config: SnackbarConfig(
|
|
backgroundColor: Colors.black.withOpacity(.5),
|
|
textColor: Colors.red,
|
|
borderRadius: 50,
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: Colors.red,
|
|
),
|
|
snackPosition: SnackPosition.TOP,
|
|
margin: EdgeInsets.all(10),
|
|
),
|
|
);
|
|
service.registerCustomSnackbarConfig(
|
|
variant: SnackbarType.info,
|
|
config: SnackbarConfig(
|
|
backgroundColor: Colors.black.withOpacity(.5),
|
|
textColor: Colors.blue,
|
|
borderRadius: 50,
|
|
icon: Icon(
|
|
Icons.info,
|
|
color: Colors.blue,
|
|
),
|
|
snackPosition: SnackPosition.TOP,
|
|
margin: EdgeInsets.all(10),
|
|
),
|
|
);
|
|
}
|