dartblock_code 3.0.0 copy "dartblock_code: ^3.0.0" to clipboard
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.

example/lib/main.dart

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,
  };
}
3
likes
160
points
22
downloads
screenshot

Publisher

verified publisheraryobarzan.com

Weekly Downloads

Block-based programming framework 'DartBlock' primarily designed for mobile devices. Supports automatic evaluation, on-device execution and exception-throwing.

Repository (GitHub)
View/report issues

Topics

#block-based #code #programming #editor

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

build_runner, collection, file_picker, flutter, flutter_code_editor, flutter_highlight, flutter_riverpod, google_fonts, highlight, json_annotation, uuid

More

Packages that depend on dartblock_code