mokr 1.0.0
mokr: ^1.0.0 copied to clipboard
Realistic mock data and images for Flutter UI development. Stable deterministic seeding. For development and prototyping only.
import 'package:flutter/material.dart';
import 'package:mokr/mokr.dart';
import 'screens/explore_screen.dart';
import 'screens/feed_screen.dart';
import 'screens/profile_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Mokr.init();
runApp(const MokrExampleApp());
}
class MokrExampleApp extends StatelessWidget {
const MokrExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'mokr example',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF5C6BC0)),
useMaterial3: true,
),
home: const _RootNav(),
);
}
}
class _RootNav extends StatefulWidget {
const _RootNav();
@override
State<_RootNav> createState() => _RootNavState();
}
class _RootNavState extends State<_RootNav> {
int _index = 0;
static const _screens = [FeedScreen(), ProfileScreen(), ExploreScreen()];
@override
Widget build(BuildContext context) {
return Scaffold(
body: IndexedStack(index: _index, children: _screens),
bottomNavigationBar: NavigationBar(
selectedIndex: _index,
onDestinationSelected: (i) => setState(() => _index = i),
destinations: const [
NavigationDestination(
icon: Icon(Icons.dynamic_feed_outlined),
selectedIcon: Icon(Icons.dynamic_feed),
label: 'Feed',
),
NavigationDestination(
icon: Icon(Icons.person_outline),
selectedIcon: Icon(Icons.person),
label: 'Profile',
),
NavigationDestination(
icon: Icon(Icons.grid_view_outlined),
selectedIcon: Icon(Icons.grid_view),
label: 'Explore',
),
],
),
);
}
}