simbadan 0.1.0 icon indicating copy to clipboard operation
simbadan: ^0.1.0 copied to clipboard

PlatformAndroid

A private flutter plugin.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:simbadan/simbadan.dart';

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

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

class _MyAppState extends State<MyApp> {
  TextEditingController numberToDialController = TextEditingController();
  List<String> _carriers = [];
  String _selectedCarrier = "";

  @override
  void initState() {
    super.initState();
  }

  getCarriers() async {
    var carriers = await Simbadan.getCarriers();

    if (carriers.length > 0) {
      setState(() {
        _carriers = carriers;
        _selectedCarrier = carriers.first;
      });
    }

    print(carriers);
  }

  dialByCarrier() {
    var numberToDial = numberToDialController.text;
    Simbadan.dialByCarrier(numberToDial, _selectedCarrier);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            RaisedButton(
                child: Text("getCarriers()"), onPressed: () => getCarriers()),
            TextField(
              decoration: InputDecoration(labelText: "numberToDial"),
              controller: numberToDialController,
              keyboardType: TextInputType.number,
            ),
            DropdownButton(
                value: _selectedCarrier,
                items: _carriers
                    .map((carrier) => DropdownMenuItem(
                          child: Text(carrier),
                          value: carrier,
                        ))
                    .toList(),
                onChanged: (v) => setState(() => _selectedCarrier = v)),
            RaisedButton(
                child: Text("dialByCarrier()"),
                onPressed: () => dialByCarrier()),
          ],
        ),
      ),
    );
  }
}
0
likes
120
pub points
22%
popularity

Publisher

unverified uploader

A private flutter plugin.

Homepage

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on simbadan