You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
Dart
48 lines
1.5 KiB
Dart
import 'package:another_flushbar/flushbar.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
class GeneralUtils{
|
|
|
|
static Duration parseTimeString(String timeString) {
|
|
try {
|
|
print('time string i got is ${timeString}');
|
|
List<String> timeParts = timeString.split(':');
|
|
|
|
int hours = int.parse(timeParts[0]);
|
|
int minutes = int.parse(timeParts[1]);
|
|
int seconds = int.parse(timeParts[2]);
|
|
|
|
print('');
|
|
|
|
return Duration(hours: hours, minutes: minutes, seconds: seconds);
|
|
} catch (e) {
|
|
if (kDebugMode) {
|
|
print("Error parsing time string: $e");
|
|
}
|
|
return Duration.zero; // Return zero duration in case of an error
|
|
}
|
|
}
|
|
static Widget showFlushBar({@required BuildContext context,String title,String message,double duration}){
|
|
return Flushbar(
|
|
flushbarPosition: FlushbarPosition.TOP,
|
|
backgroundColor: AppColor.green70,
|
|
title:title?? "Hey Ninja",
|
|
message:message?? "Lorem Ipsum is simply dummy text of the printing and typesetting industry",
|
|
duration: Duration(seconds:duration?? 3),
|
|
flushbarStyle: FlushbarStyle.GROUNDED,
|
|
reverseAnimationCurve: Curves.easeInOut,
|
|
mainButton: IconButton(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
icon: const Icon(
|
|
Icons.close,
|
|
color: AppColor.white20,
|
|
),
|
|
),
|
|
)..show(context);
|
|
}
|
|
} |