Skip to content

Instantly share code, notes, and snippets.

View mhadaily's full-sized avatar
🎯
Let's Flutter

Majid Hajian mhadaily

🎯
Let's Flutter
View GitHub Profile
// myTextWIdget my_text_widget.dart
import 'package:flutter/material.dart';
class MyTextWidget extends StatelessWidget {
MyTextWidget({
this.title,
this.fontWeight,
this.fontSize,
this.color,
});
@mhadaily
mhadaily / Update website if there is new servicer worker update found.md
Created November 14, 2020 14:14
Use it in your index.html file in Flutter Web.
function invokeServiceWorkerUpdateFlow() {
  // you have a better UI here, reloading is not a great user experince here.
  const confirmed = confirm('New version of the app is available. Refresh now');
  if (confirmed) {
    window.location.reload();
  }
}
async function handleServiceWorker() {
@mhadaily
mhadaily / index.html
Last active January 18, 2022 00:48
Adding custom DOM elements using HTML slots to render platform views in the Flutter web
<script>
document.querySelector('#username').addEventListener('input', console.log);
document.querySelector('#password').addEventListener('input', console.log);
</script>
@mhadaily
mhadaily / disable-tab.dart
Created March 7, 2022 16:17
Disable tab index in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(const TabBarDemo());
}
class TabBarDemo extends StatefulWidget {
const TabBarDemo();
@override
@mhadaily
mhadaily / loading.dart
Last active July 28, 2025 18:42
Loading Progress in Flutter With Test
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});