gliaplayer 0.0.6 copy "gliaplayer: ^0.0.6" to clipboard
gliaplayer: ^0.0.6 copied to clipboard

This repository is for the GliaPlayer Flutter plugin, which enables publishers to monetize Flutter apps using the GliaPlayer SDK.

example/lib/main.dart

// The sample code below shows how to add GliaPlayerView to the UI layout,
  // so that it always sticks to the bottom right corner of the void screen.

import 'package:flutter/material.dart';

import 'package:gliaplayer/gliaplayer.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'dart:math';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await MobileAds.instance.initialize();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  Color getRandomColor() {
    final Random random = Random();
    return Color.fromARGB(
      255,
      random.nextInt(256),
      random.nextInt(256),
      random.nextInt(256),
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Stack(
          children: [
            // Layer 1: Scrollable Content (Column)
            Positioned.fill(
              child: SingleChildScrollView(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    // Loop 1..100 Boxes
                    // We use the spread operator (...) to insert the list into the children
                    ...List.generate(100, (index) {
                      return Column(
                        children: [
                          Container(
                            width: double.infinity, // Modifier.fillMaxWidth()
                            height: 320,
                            color: getRandomColor(),
                          ),
                          const SizedBox(height: 16), // Spacer
                        ],
                      );
                    }),
                  ],
                ),
              ),
            ),

            // Layer 2: Floating Android View (Bottom End)
            Align(
              alignment: Alignment.bottomRight, 
              child: SizedBox(
                width: 320,
                height: 220,
                child: GliaPlayer(
                  androidSlotKey: 'gliacloud_app_test',
                  iOSSlotKey: 'gliacloud_app_test',
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
119
downloads

Documentation

API reference

Publisher

verified publishergliacloud.com

Weekly Downloads

This repository is for the GliaPlayer Flutter plugin, which enables publishers to monetize Flutter apps using the GliaPlayer SDK.

Homepage

License

BSD-3-Clause (license)

Dependencies

flutter, google_mobile_ads, plugin_platform_interface, url_launcher, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on gliaplayer

Packages that implement gliaplayer