flutter_awesome_calculator 1.0.0+1 flutter_awesome_calculator: ^1.0.0+1 copied to clipboard
Flutter calculator package for adding calculator into flutter app.
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_awesome_calculator/flutter_awesome_calculator.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Awesome Calculator',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Awesome Calculator'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Align(
alignment: Alignment.bottomCenter,
child: FlutterAwesomeCalculator(
context: context,
digitsButtonColor: Colors.white,
backgroundColor: Colors.white,
expressionAnswerColor: Colors.black,
showAnswerField: true,
fractionDigits: 1,
buttonRadius: 8,
onChanged: (ans,expression){
},
),
),
);
}
}