Erweiterungen

This commit is contained in:
Sven committed 2024-02-08 09:59:31 +01:00
1 parent 3c2e9ceecb
commit 85d6d49258
16 files changed
+98 -77

No files matched your search

+7 -37
View File
@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -181,45 +182,14 @@ class Util {
throw Exception('Could not launch $websiteUrl');
}
}
static Future<void> playMp3(String name) async {
final player = AudioPlayer();
await player.play(AssetSource('sounds/$name'), volume: 1);
}
}
Widget getDefaultButton(String text, Function() onPressed, {Image? image, double? buttonHeight}) {
/*return SizedBox(
height: buttonHeight ?? 60,
child: Stack(
fit: StackFit.expand,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.all(0),
child: Expanded(
child: SizedBox(
height: 60,
child: ElevatedButton(
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
side: const BorderSide(color: Colors.grey),
),
),
backgroundColor: MaterialStateProperty.all<Color>(const Color.fromARGB(255, 220, 220, 220)),
foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
),
onPressed: () {
onPressed();
},
child: Text(text)),
),
),
),
],
),
Positioned(left: 20, top: 15, child: Center(child: image))
],
),
);*/
return SizedBox(
height: buttonHeight ?? 50,
child: MaterialButton(
@@ -244,7 +214,7 @@ Widget getDefaultButton(String text, Function() onPressed, {Image? image, double
Expanded(
child: Text(
text,
style: const TextStyle(color: Colors.black, fontSize: 18.0),
style: const TextStyle(color: Colors.black, fontSize: 14.0),
textAlign: TextAlign.center,
),
),