Skip to content

Instantly share code, notes, and snippets.

View matifdeveloper's full-sized avatar
🎯
Focusing

Muhammad Atif matifdeveloper

🎯
Focusing
View GitHub Profile
@matifdeveloper
matifdeveloper / dotted_border.dart
Created July 4, 2024 05:27
Custom dotted border in flutter
import 'package:flutter/material.dart';
class DottedBorder extends StatelessWidget {
final double strokeWidth;
final Color color;
final double dashLength;
final double dashGap;
final Shape shape;
final Widget child;
@matifdeveloper
matifdeveloper / multiple_selection_listview.dart
Created May 30, 2024 07:31
Gmail-like Multiple Selection ListView
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@matifdeveloper
matifdeveloper / stop_watch.dart
Created April 16, 2024 06:05
Stop watch in dart
import 'dart:async';
void main() async {
var stopWatch = Stopwatch();
stopWatch.start();
await Future.delayed(const Duration(seconds: 2), () {});
stopWatch.stop();
@matifdeveloper
matifdeveloper / main.dart
Created January 30, 2024 07:47
Stream controller
import 'dart:async';
void main() {
// Create a StreamController with integers
StreamController<int> streamController = StreamController<int>();
// Create a stream from the controller
Stream<int> stream = streamController.stream;
// Add a listener to the stream
@matifdeveloper
matifdeveloper / main.dart
Created January 30, 2024 06:20
Birth Year calculator
void main() {
// Assuming the current year is 2024
int currentYear = 2024;
// Age input
int age = 4;
// Calculate birth year
int birthYear = currentYear - age;
@matifdeveloper
matifdeveloper / main.dart
Created January 23, 2024 05:39
Nested ListView.builder in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@matifdeveloper
matifdeveloper / main.dart
Created January 23, 2024 05:04
Text Animation Flutter
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@matifdeveloper
matifdeveloper / main.dart
Created January 19, 2024 06:52
File extension
void main() {
String path = "assets/images/abc.svg";
String file = path.fileExtension();
print("File extension: $file");
}
extension StringExtension on String {
String fileExtension() {
@matifdeveloper
matifdeveloper / main.dart
Created January 19, 2024 06:17
Last and Unique 4 valuse in List
class ChatsModel {
int? id;
String? title;
String chatName;
String chatType;
String icon;
bool isPinned;
ChatsModel({this.id, this.title, required this.chatName, required this.chatType, required this.icon, required this.isPinned});
}
@matifdeveloper
matifdeveloper / main.dart
Created January 19, 2024 04:54
Text Inside Brackets
extension StringExtension on String {
String? getTextInsideBrackets() {
RegExp regExp = RegExp(r'\[([^\]]*)\]');
RegExpMatch? match = regExp.firstMatch(this);
return match?.group(1);
}
}
void main() {