dartblock_code 3.0.0
dartblock_code: ^3.0.0 copied to clipboard
Block-based programming framework 'DartBlock' primarily designed for mobile devices. Supports automatic evaluation, on-device execution and exception-throwing.
import 'package:example/pages/root_page.dart';
import 'package:example/theme.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black.withValues(alpha: 0.002),
),
);
runApp(const DartBlockExample());
}
class DartBlockExample extends StatelessWidget {
const DartBlockExample({super.key});
@override
Widget build(BuildContext context) {
/// Important: the dartblock_code package relies on riverpod for state management.
/// However, if the host app also relies on riverpod, there will be no conflicts between
/// the ProviderScopes of the host app and dartblock_code itself.
///
/// In other words, whether your app uses riverpod or not, dartblock_code will work seamlessly.
return ProviderScope(
child: MaterialApp(
scrollBehavior: _ScrollBehavior(),
debugShowCheckedModeBanner: false,
title: 'DartBlock',
theme: ThemeData(
useMaterial3: true,
colorScheme: MaterialTheme.lightScheme(),
textTheme: GoogleFonts.robotoTextTheme(),
),
darkTheme: ThemeData(
useMaterial3: true,
colorScheme: MaterialTheme.darkScheme(),
textTheme: GoogleFonts.robotoTextTheme(
ThemeData(brightness: Brightness.dark).textTheme,
),
),
home: const RootPage(),
),
);
}
}
class _ScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}