physical_platform 0.3.1 copy "physical_platform: ^0.3.1" to clipboard
physical_platform: ^0.3.1 copied to clipboard

A Flutter package that simplifies the cross-platform development process by providing declarative and pragmatic instruments.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:physical_platform/physical_platform.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text('example')),
        body: Builder(builder: (context) {
          return PhysicalPlatformDispatcher(
            mobileSystems: (_, __) =>
                const WebView(initialUrl: "https://wikipedia.org"),
            other: (_, __) => Center(
              child: Text(
                  'Platform doesn\'t support the official webview\n${context.size}'),
            ),
          );
        }),
      ),
    );
  }

  Widget a() {
    return ElevatedButton(
      onPressed: () {
        // do smth with context
      },
      child: const Text('mobile'),
    );
  }
}
1
likes
160
points
37
downloads

Publisher

verified publishermanuelplavsic.ch

Weekly Downloads

A Flutter package that simplifies the cross-platform development process by providing declarative and pragmatic instruments.

Repository (GitLab)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

abstract_platform, flutter

More

Packages that depend on physical_platform