call_mode 0.1.1 copy "call_mode: ^0.1.1" to clipboard
call_mode: ^0.1.1 copied to clipboard

A handy plugin for retrieving and observing a current call mode

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  String _getCallModeString(CallMode mode) {
    return switch (mode) {
      CallMode.none => 'None',
      CallMode.ringing => 'Ringing',
      CallMode.inProgress => 'In progress',
    };
  }

  Color _getStateColor(CallMode mode) {
    return switch (mode) {
      CallMode.inProgress => Colors.red,
      CallMode.none => Colors.green,
      CallMode.ringing => Colors.yellow
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: CallModeBuilder(
        builder: (context, callMode) {
          return Scaffold(
            backgroundColor: _getStateColor(callMode),
            body: Center(
              child: Text('Call mode: ${_getCallModeString(callMode)}'),
            ),
          );
        },
      ),
    );
  }
}
2
likes
150
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

A handy plugin for retrieving and observing a current call mode

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on call_mode