feat(example_full): create example representing the whole plugin functional

This commit is contained in:
ksenia312
2024-02-06 19:41:56 +01:00
parent 258cdf0adc
commit f71121bd92
89 changed files with 3112 additions and 1164 deletions
-45
View File
@@ -1,45 +0,0 @@
part of '../main.dart';
enum _ActionButtonType {
idle(Color(0xFF00C853)),
warning(Color(0xFFD50000));
const _ActionButtonType(this.color);
final Color color;
}
class _ActionButton extends StatelessWidget {
const _ActionButton({
required this.onTap,
required this.title,
this.type = _ActionButtonType.idle,
});
final VoidCallback onTap;
final String title;
final _ActionButtonType type;
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onTap,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.white,
maximumSize: const Size(150, 70),
minimumSize: const Size(70, 70),
elevation: 3,
surfaceTintColor: type.color.withOpacity(0.05),
),
child: Text(
title,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: type.color,
height: 1,
),
),
);
}
}
-31
View File
@@ -1,31 +0,0 @@
part of '../main.dart';
class ActionDialog {
ActionDialog._();
static Future<bool?> show(
BuildContext context, {
required String title,
required String subtitle,
}) {
return showDialog<bool>(
context: context,
builder: (context) {
return AlertDialog(
title: Text(title),
content: Text(subtitle),
actions: [
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
child: const Text('Yes'),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(false),
child: const Text('No'),
),
],
);
},
);
}
}
-40
View File
@@ -1,40 +0,0 @@
import 'package:flutter/material.dart';
class AppShackBar {
AppShackBar._();
static ScaffoldFeatureController<SnackBar, SnackBarClosedReason>? show(
BuildContext context,
String title, {
String? subtitle,
}) {
return ScaffoldMessenger.maybeOf(context)?.showSnackBar(
SnackBar(
content: RichText(
text: TextSpan(
text: '$title \n',
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
children: [
if (subtitle != null)
TextSpan(
text: subtitle,
style: const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
),
),
],
),
),
behavior: SnackBarBehavior.floating,
margin: const EdgeInsets.only(
left: 12,
right: 12,
bottom: 20,
),
backgroundColor: Colors.pink.shade800,
duration: const Duration(seconds: 2),
),
);
}
}
+3 -1114
View File
File diff suppressed because it is too large Load Diff
-29
View File
@@ -1,29 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:nearby_service_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp(
service: AppService(),
));
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}