Skip to content

Instantly share code, notes, and snippets.

@iifast2
Last active February 19, 2024 11:45
Show Gist options
  • Save iifast2/4dd11a8de9505cd95c5390f95701f223 to your computer and use it in GitHub Desktop.
Save iifast2/4dd11a8de9505cd95c5390f95701f223 to your computer and use it in GitHub Desktop.
FF Fixing PUBSPEC.YAML DownGrading Flutter <4
name: expandy_nav
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
/*
environment:
sdk: ">=3.0.0 <4.0.0"
*/
environment:
sdk: '>=2.19.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
auto_size_text: ^3.0.0 # Check for compatibility and updates
cached_network_image: ^3.2.1
flutter_animate: ^4.1.1+1
flutter_cache_manager: ^3.3.0
font_awesome_flutter: ^10.1.0
from_css_color: ^2.0.0
go_router: ^7.1.1
google_fonts: ^4.0.3
json_path: ^0.4.1
page_transition: ^2.0.4
path_provider: ^2.0.14
path_provider_android: ^2.0.25
path_provider_foundation: ^2.2.2
path_provider_platform_interface: ^2.0.6
provider: ^6.0.4
shared_preferences: ^2.0.15
shared_preferences_android: ^2.1.0
shared_preferences_ios: ^2.1.1
shared_preferences_platform_interface: ^2.2.0
shared_preferences_web: ^2.1.0
sqflite: ^2.2.6
timeago: ^3.2.2
url_launcher: ^6.1.10
url_launcher_android: ^6.0.27
url_launcher_ios: ^6.1.4
url_launcher_platform_interface: ^2.1.2
####################### Updated (these) ###########################
flutter_native_splash: ^2.2.9
xml: ^6.1.0
universal_io: ^2.1.0
intl: ^0.17.0
####################### Updated (these) ###########################
cupertino_icons: ^1.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/fonts/
- assets/images/
- assets/videos/
- assets/audios/
- assets/lottie_animations/
- assets/rive_animations/
- assets/pdfs/
@iifast2
Copy link
Author

iifast2 commented Aug 13, 2023

  • Version 4 :
MediaQuery.sizeOf(context).width < kBreakpointSmall;
  • Version 3.7.9 or lil higher
MediaQuery.of(context).size.width < kBreakpointSmall;

  • Version 4 :
MediaQuery.sizeOf(context)
  • Version 3.7.9 or lil higher
MediaQuery.of(context).size

@iifast2
Copy link
Author

iifast2 commented Aug 13, 2023

Instead of using

MediaQuery.viewInsetsOf(context)

to get the view insets, you can directly use the

MediaQuery.of(context).viewInsets

property to achieve the same effect.

@iifast2
Copy link
Author

iifast2 commented Aug 16, 2023

flutter run on web (chrome) :

-d chrome --web-hostname localhost --web-port 5000 --web-renderer html

@iifast2
Copy link
Author

iifast2 commented Aug 16, 2023

flutter --version

Flutter 3.7.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 62bd79521d (6 weeks ago) • 2023-03-30 10:59:36 -0700
Engine • revision ec975089ac
Tools • Dart 2.19.6 • DevTools 2.20.1

@iifast2
Copy link
Author

iifast2 commented Dec 16, 2023

rules_version ='2';
service cloud.firestore {
 match /databases/{database}/documents {

	match /users/{userId} {

	allow read: if isSignedIn();
	allow update, delete: if hasAnyRole(['admin']);		
}




function isSignedIn() {
 return request.auth != null;
}

function hasAnyRole(roles) {
return isSignedIn() && get(/databases/$(database)/documents/users/$(request.auth.uid)).data.roles.hasAny(roles)
}

@iifast2
Copy link
Author

iifast2 commented Feb 19, 2024

// LESSON DETAILS 

import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';



class LessonDetailsComponentWidget extends StatefulWidget {
  const LessonDetailsComponentWidget({

    String? thumbnailPic,
    String? title,
    String? author,
    String? authorJobTitle,
    String? lessonDescription,
    bool? showVideo,
  
  
  })  : this.thumbnailPic = thumbnailPic ??
      'https://images.unsplash.com/photo-1580894732444-8ecded7900cd?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
        this.title = title ?? 'Project Management fundamentals',
        this.author = author ?? 'Simon Shaw,',
        this.authorJobTitle = authorJobTitle ?? 'Product Owner',
        this.lessonDescription = lessonDescription ??
            'This comprehensive Project Management Fundamentals course is designed to provide participants with a solid understanding of the essential principles, techniques, and best practices in project management. Whether you\'re a seasoned professional seeking a refresher or a newcomer to the field, this course offers a practical and hands-on approach to mastering the fundamentals of project management.',
        this.showVideo = showVideo ?? true;

  final String thumbnailPic;
  final String title;
  final String author;
  final String authorJobTitle;
  final String lessonDescription;
  final bool showVideo;

  @override
  State<LessonDetailsComponentWidget> createState() =>
      _LessonDetailsComponentWidgetState();
}

class _LessonDetailsComponentWidgetState
    extends State<LessonDetailsComponentWidget> with TickerProviderStateMixin {




  @override
  void setState(VoidCallback callback) {
    super.setState(callback);

  }

  @override
  void initState() {
    super.initState();


    WidgetsBinding.instance.addPostFrameCallback((_) => setState(() {}));
  }

  @override
  void dispose() {


    super.dispose();
  }

  @override
  Widget build(BuildContext context) {


    return Container(
      width: 751.29,
      height: 708,
      decoration: BoxDecoration(
        color: FlutterFlowTheme.of(context).secondaryBackground,
        boxShadow: const  [
         BoxShadow(
            blurRadius: 5,
            color: Color(0x28000000),
            offset: Offset(0, 2),
          )
        ],
        borderRadius: const BorderRadius.only(
          bottomLeft: Radius.circular(12),
          bottomRight: Radius.circular(12),
          topLeft: Radius.circular(0),
          topRight: Radius.circular(0),
        ),
      ),
      child: Padding(
        padding: const EdgeInsets.all(12),
        child: Column(
          mainAxisSize: MainAxisSize.max,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            if (valueOrDefault<bool>(
              widget.showVideo == true,
              false,
            ))
              Container(
                height: 400,
                child: Stack(
                  children: [
                    InkWell(
                      splashColor: Colors.transparent,
                      focusColor: Colors.transparent,
                      hoverColor: Colors.transparent,
                      highlightColor: Colors.transparent,
                      onTap: () async {},
                      child: Hero(
                        tag: widget.thumbnailPic,
                        transitionOnUserGestures: true,
                        child: ClipRRect(
                          borderRadius: BorderRadius.circular(8),
                          child: Image.network(
                            widget.thumbnailPic,
                            width: double.infinity,
                            height: 400,
                            fit: BoxFit.cover,
                          ),
                        ),
                      ),
                    ),
                    Align(
                      alignment: const AlignmentDirectional(0, 1),
                      child: Padding(
                        padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 12),
                        child: ClipRRect(
                          borderRadius: BorderRadius.circular(12),
                          child: BackdropFilter(
                            filter: ImageFilter.blur(
                              sigmaX: 4,
                              sigmaY: 4,
                            ),
                            child: Stack(
                              children: [
                                Align(
                                  alignment: const AlignmentDirectional(0, 0),
                                  child: Container(
                                    width: 93,
                                    height: 93,
                                    decoration: const BoxDecoration(
                                      color: Color(0x4DFFFFFF),
                                      boxShadow: [
                                        BoxShadow(
                                          blurRadius: 5,
                                          color: Color(0x28FFFFFF),
                                          offset: Offset(0, 2),
                                        )
                                      ],
                                      shape: BoxShape.circle,
                                    ),
                                    child: Padding(
                                      padding: const EdgeInsets.all(12),
                                      child: Column(
                                        mainAxisSize: MainAxisSize.max,
                                        mainAxisAlignment:
                                        MainAxisAlignment.center,
                                        crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                        children: [
                                          Row(
                                            mainAxisSize: MainAxisSize.max,
                                            mainAxisAlignment:
                                            MainAxisAlignment.center,
                                            children: [
                                              Icon(
                                                Icons.play_arrow,
                                                color:
                                                FlutterFlowTheme.of(context)
                                                    .secondaryBackground,
                                                size: 50,
                                              ),
                                            ].divide(const SizedBox(width: 8)),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                ),
                                Align(
                                  alignment: const AlignmentDirectional(-1, 1),
                                  child: Container(
                                    width: 93,
                                    height: 44,
                                    decoration: BoxDecoration(
                                      color: const Color(0x3CFFFFFF),
                                      boxShadow:  const [
                                       BoxShadow(
                                          blurRadius: 5,
                                          color: Color(0x28FFFFFF),
                                          offset: Offset(0, 2),
                                        )
                                      ],
                                      borderRadius: BorderRadius.circular(12),
                                    ),
                                    child: Padding(
                                      padding: const EdgeInsets.all(8),
                                      child: Column(
                                        mainAxisSize: MainAxisSize.max,
                                        mainAxisAlignment:
                                        MainAxisAlignment.center,
                                        crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                        children: [
                                          Row(
                                            mainAxisSize: MainAxisSize.max,
                                            mainAxisAlignment:
                                            MainAxisAlignment.start,
                                            children: [
                                              Icon(
                                                Icons.remove_red_eye,
                                                color:
                                                FlutterFlowTheme.of(context)
                                                    .secondaryBackground,
                                                size: 24,
                                              ),
                                              Text(
                                                '700',
                                                style:
                                                FlutterFlowTheme.of(context)
                                                    .labelLarge
                                                    .override(
                                                  fontFamily:
                                                  FlutterFlowTheme.of(
                                                      context)
                                                      .labelLargeFamily,
                                                  color: FlutterFlowTheme
                                                      .of(context)
                                                      .secondaryBackground,
                                                  fontWeight:
                                                  FontWeight.w600,
                                                  useGoogleFonts: GoogleFonts
                                                      .asMap()
                                                      .containsKey(
                                                      FlutterFlowTheme.of(
                                                          context)
                                                          .labelLargeFamily),
                                                ),
                                              ),
                                            ].divide(const SizedBox(width: 8)),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                ),
                              ],
                            ),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            Padding(
              padding: const EdgeInsetsDirectional.fromSTEB(4, 12, 0, 0),
              child: Text(
                valueOrDefault<String>(
                  widget.title,
                  'Project Management fundamentals',
                ),
                style: FlutterFlowTheme.of(context).headlineSmall.override(
                  fontFamily: 'Poppins',
                  fontWeight: FontWeight.w600,
                  useGoogleFonts: GoogleFonts.asMap().containsKey(
                      FlutterFlowTheme.of(context).headlineSmallFamily),
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 12),
              child: Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Padding(
                    padding: const EdgeInsetsDirectional.fromSTEB(4, 4, 5, 0),
                    child: Text(
                      'By ',
                      style: FlutterFlowTheme.of(context).labelMedium.override(
                        fontFamily: 'Poppins',
                        color: const Color(0xFF384E58),
                        useGoogleFonts: GoogleFonts.asMap().containsKey(
                            FlutterFlowTheme.of(context).labelMediumFamily),
                      ),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsetsDirectional.fromSTEB(4, 4, 5, 0),
                    child: Text(
                      widget.author,
                      style: FlutterFlowTheme.of(context).labelMedium.override(
                        fontFamily: 'Poppins',
                        color: const Color(0xFF119B78),
                        fontWeight: FontWeight.w600,
                        useGoogleFonts: GoogleFonts.asMap().containsKey(
                            FlutterFlowTheme.of(context).labelMediumFamily),
                      ),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsetsDirectional.fromSTEB(4, 4, 16, 0),
                    child: Text(
                      widget.authorJobTitle,
                      style: FlutterFlowTheme.of(context).labelMedium.override(
                        fontFamily: 'Poppins',
                        color: const Color(0xFF384E58),
                        fontWeight: FontWeight.w500,
                        useGoogleFonts: GoogleFonts.asMap().containsKey(
                            FlutterFlowTheme.of(context).labelMediumFamily),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsetsDirectional.fromSTEB(0, 8, 0, 0),
              child: Row(
                mainAxisSize: MainAxisSize.max,
                children: [
                  Padding(
                    padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 16, 0),
                    child: Container(
                      height: 32,
                      decoration: BoxDecoration(
                        color: const Color(0xFF119B78),
                        borderRadius: BorderRadius.circular(20),
                      ),
                      alignment: const AlignmentDirectional(0, 0),
                      child: Padding(
                        padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 0),
                        child: Text(
                          'Information',
                          style: FlutterFlowTheme.of(context)
                              .bodySmall
                              .override(
                            fontFamily: FlutterFlowTheme.of(context)
                                .bodySmallFamily,
                            color: Colors.white,
                            useGoogleFonts: GoogleFonts.asMap().containsKey(
                                FlutterFlowTheme.of(context)
                                    .bodySmallFamily),
                          ),
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Text(
                      'Content',
                      style: FlutterFlowTheme.of(context).labelSmall.override(
                        fontFamily:
                        FlutterFlowTheme.of(context).labelSmallFamily,
                        color: const Color(0xFF384E58),
                        useGoogleFonts: GoogleFonts.asMap().containsKey(
                            FlutterFlowTheme.of(context).labelSmallFamily),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Flexible(
              child: Padding(
                padding: const EdgeInsetsDirectional.fromSTEB(4, 9, 16, 0),
                child: Text(
                  widget.lessonDescription,
                  style: FlutterFlowTheme.of(context).labelMedium.override(
                    fontFamily:
                    FlutterFlowTheme.of(context).labelMediumFamily,
                    color: const Color(0xFF384E58),
                    useGoogleFonts: GoogleFonts.asMap().containsKey(
                        FlutterFlowTheme.of(context).labelMediumFamily),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

@iifast2
Copy link
Author

iifast2 commented Feb 19, 2024

image

@iifast2
Copy link
Author

iifast2 commented Feb 19, 2024

HTML EDITOR WITH PRINT ON CMD !

import 'package:flutter/material.dart';
import 'package:html_editor_enhanced/html_editor.dart';

class OldCustomHtmlEditor extends StatefulWidget {
  const OldCustomHtmlEditor({super.key});

  @override
  State<OldCustomHtmlEditor> createState() => _OldCustomHtmlEditorState();
}

class _OldCustomHtmlEditorState extends State<OldCustomHtmlEditor> {
  final HtmlEditorController controller = HtmlEditorController();

  void _printCurrentContent() async {
    String? currentText = await controller.getText();
    print(currentText ?? 'No content');
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ElevatedButton(
          onPressed: _printCurrentContent,
          child: const Text('Get HTML Content'),
        ),
        Expanded(
          child: HtmlEditor(
            controller: controller,
            htmlToolbarOptions: HtmlToolbarOptions(
              textStyle: Theme.of(context).textTheme.titleLarge,
              toolbarPosition: ToolbarPosition.aboveEditor,
              toolbarType: ToolbarType.nativeGrid,
              defaultToolbarButtons: [
                const StyleButtons(),
                const FontButtons(),
                const ColorButtons(),
                const ParagraphButtons(),
                const ListButtons(),
                const InsertButtons(
                  link: true,
                  picture: true,
                  video: false,
                  hr: true,
                ),
                const OtherButtons(
                  fullscreen: true,
                  codeview: true,
                  copy: true,
                  paste: true,
                ),
              ],
            ),
            otherOptions: const OtherOptions(
              height: 700,
            ),
            htmlEditorOptions: HtmlEditorOptions(
              hint: "Your text here...",
              initialText: "<p>Initial text content</p>",
            ),
          ),
        ),
      ],
    );
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment