coolfix_flutter 0.2.0
coolfix_flutter: ^0.2.0 copied to clipboard
CoolFix support inquiry and replay SDK for Flutter applications.
example/lib/main.dart
import 'package:coolfix_flutter/coolfix_flutter.dart';
import 'package:flutter/material.dart';
const _appToken = String.fromEnvironment('COOLFIX_APP_TOKEN');
String requireAppToken(String token) {
if (token.isEmpty) {
throw StateError(
'COOLFIX_APP_TOKEN is required. Run with --dart-define=COOLFIX_APP_TOKEN=cfx_pub_your_app.',
);
}
return token;
}
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await CoolFix.start(requireAppToken(_appToken));
runApp(const CoolFixApp(child: ExampleApp()));
}
final class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
title: 'CoolFix Example',
restorationScopeId: 'coolfix_example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF3D5AFE)),
useMaterial3: true,
),
home: const ExampleHome(),
);
}
final class ExampleHome extends StatelessWidget {
const ExampleHome({super.key});
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('CoolFix')),
body: Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: FilledButton.icon(
onPressed: () => CoolFix.presentInquiry(context),
icon: const Icon(Icons.support_agent),
label: const Text('문의하기'),
),
),
),
);
}