userorient_flutter 0.1.4 copy "userorient_flutter: ^0.1.4" to clipboard
userorient_flutter: ^0.1.4 copied to clipboard

Discover what your users really want and stop building wrong features.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:userorient_flutter/userorient_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  UserOrient.configure(
    apiKey: '7c8aa27f-54af-4de7-804e-c5c04de563fd',
    languageCode: 'en',
  );

  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SizedBox(
        width: double.infinity,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ListTile(
              leading: const Icon(Icons.feedback),
              title: const Text(
                'Feature requests',
              ),
              subtitle: const Text(
                'View and vote on feature requests',
              ),
              onTap: () async {
                UserOrient.setUser(
                  uniqueIdentifier: 'nOtNDo3KGPU0q7IKnal3rUyURZ82',
                  fullName: 'Alex Maina',
                  email: 'mainahmwangi12@gmail.',
                  language: 'en',
                  extra: {
                    'is_premium': true,
                    'is_azerbaijani': true,
                    'online_session_count': 17,
                    'subscription_date': '2021-09-01',
                  },
                );

                debugPrint('Opening board');
                await UserOrient.openBoard(context);
                debugPrint('Board closed');
              },
            ),
            ListTile(
              leading: const Icon(Icons.feedback),
              title: const Text(
                'Logout',
              ),
              onTap: () {
                UserOrient.clearCache();
              },
            ),
          ],
        ),
      ),
    );
  }
}