test_sample_plugin_flutter 0.0.2 copy "test_sample_plugin_flutter: ^0.0.2" to clipboard
test_sample_plugin_flutter: ^0.0.2 copied to clipboard

Support for test publish plugin use native code. Use for tracking event data.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:test_sample_plugin_flutter/test_sample_plugin_flutter.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              /// Phần 2. Hướng dẫn tạo Widget với plugin
              SampleButton(
                text: "Sample Button",
                onPressed: () {
                  print("Sample Button Click");
                },
              ),

              TextButton(
                  child:
                      Text("TextButton With Background and Foreground Color"),
                  onPressed: () {
                    SampleCallNativeFlutter.testCallNative;
                  },
                  style: ButtonStyle(
                    backgroundColor:
                        MaterialStateProperty.all<Color>(Colors.greenAccent),
                    foregroundColor:
                        MaterialStateProperty.all<Color>(Colors.red),
                  )),

              /// Phần 3. Hướng dẫn gọi native code từ plugin
              FutureBuilder<String?>(
                future: SampleCallNativeFlutter.platformVersion,
                builder: (_, snapshoot) {
                  return Text(snapshoot.data ?? '');
                },
              ),

              /// Phần 4. Hướng dẫn gọi native code từ plugin
              FutureBuilder<bool?>(
                future: SampleCallNativeFlutter.isToday(DateTime.now()),
                builder: (_, snapshoot) {
                  return Text(
                      'isToDay: ${DateTime.now()} is ${snapshoot.data}');
                },
              ),
              FutureBuilder<bool?>(
                future: SampleCallNativeFlutter.isToday(DateTime(2021, 01, 01)),
                builder: (_, snapshoot) {
                  return Text(
                      'isToDay: ${DateTime(2021, 01, 01)} is ${snapshoot.data}');
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
105
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

Support for test publish plugin use native code. Use for tracking event data.

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on test_sample_plugin_flutter

Packages that implement test_sample_plugin_flutter