v1.2.0
message_segment_calculator
GSM 및 UCS-2 인코딩을 지원하는 메시지에 대한 SMS 세그먼트를 효율적으로 계산합니다. 정확한 SMS 길이 및 비용 관리가 필요한 앱에 적합합니다.
8좋아요 4530일 다운로드160Pub 점수
AndroidiOSWebmacOSWindowsLinux
SMS 세그먼트 계산기는 개발자가 메시지에 필요한 SMS 세그먼트 수를 정확하게 계산하는 데 도움을 주는 Dart 패키지입니다.
^1.4.0^1.26.2^3.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
The SMS Segment Calculator is a Dart package designed to help developers accurately calculate the number of SMS segments required for messages. It supports both GSM-7 and UCS-2 encoding standards, providing a robust solution for applications that involve SMS messaging. The package ensures cost-effective messaging by optimizing message segmentation and encoding.
To integrate the SMS Segment Calculator into your Dart or Flutter project, add the following dependency to your pubspec.yaml file:
dependencies:
message_segment_calculator: ^1.1.0
## Usage
import 'package:flutter/material.dart';
import 'package:message_segment_calculator/src/segmented_message.dart';
void main() {
runApp(const App());
}
/// The root widget of the application.
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MessageSegmentCalculatorWidget(),
);
}
}
/// A stateful widget that provides a UI for calculating message segments.
class MessageSegmentCalculatorWidget extends StatefulWidget {
const MessageSegmentCalculatorWidget({super.key});
@override
State<MessageSegmentCalculatorWidget> createState() =>
_MessageSegmentCalculatorWidgetState();
}
/// The state class for [MessageSegmentCalculatorWidget].
class _MessageSegmentCalculatorWidgetState
extends State<MessageSegmentCalculatorWidget> {
final textEditingController = TextEditingController();
SegmentedMessage? segmentedMessage;
@override
void dispose() {
textEditingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Message Segment Calculator'),
),
body: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
const Text('Enter text'),
const SizedBox(height: 10),
TextFormField(
decoration: const InputDecoration(),
controller: textEditingController,
onChanged: (value) {
setState(() {
segmentedMessage = SegmentedMessage(value);
});
},
),
const SizedBox(height: 10),
Text('Number of characters: ${segmentedMessage?.numberOfCharacters}'),
Text('Number of segments: ${segmentedMessage?.segmentsCount}'),
Text('Number of Unicode scalars: ${segmentedMessage?.numberOfUnicodeScalars}'),
Text('Message size in bits: ${segmentedMessage?.messageSize}'),
Text('Total size in bits: ${segmentedMessage?.totalSize}'),
],
),
),
);
}
}
### Key Additions:
- **Detailed Descriptions**: Each class is explained to clarify its role in the package.
- **Usage Example**: Shows a practical example to help developers quickly understand how to use the package.
- **Installation Instructions**: Guides users on how to add the package to their project.
- **Contribution Guidelines**: Encourages contributions and provides a link to the issues page.
This README provides a comprehensive overview, making it easier for users to understand and use the package effectively.