gliaplayer 0.0.5
gliaplayer: ^0.0.5 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
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',
),
),
),
],
),
),
);
}
}