Skip to content

Instantly share code, notes, and snippets.

View Devlonoah's full-sized avatar
🌍
,,,,,....''''

Opeyemi Lawal Devlonoah

🌍
,,,,,....''''
  • ....
  • Lagos,Nigeria
View GitHub Profile
@Devlonoah
Devlonoah / learn.md
Created May 6, 2024 18:49 — forked from rylev/learn.md
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@Devlonoah
Devlonoah / folder_structure.txt
Created April 13, 2024 06:59 — forked from joukhar/folder_structure.txt
best flutter project structure based on getx
└── lib
├── app
├── core
├── configs
├── constants
└── themes
├── data
└── categories.dart
└── models
└── category.dart
@Devlonoah
Devlonoah / Set_with_equatable.dart
Created November 2, 2023 12:30
Equality using equatable with Set
import 'package:equatable/equatable.dart';
void main() {
Set<InfoModel> info = {};
for (var data in infoList) {
info.add(data);
}
print("All unique info saved: $info");
@Devlonoah
Devlonoah / richtext_gesturedetect.dart
Created September 13, 2023 11:35
Gesture on Richtext Flutter
RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Single tap',
style: TextStyle(color: Colors.red[300]),
recognizer: TapGestureRecognizer()..onTap = () {
// Single tapped.
},
),
@Devlonoah
Devlonoah / show_dropdown.dart
Created August 27, 2023 20:24
Programmatically open dropdown
var items = ["Howdy", "Hello", "Hi", "Salud"];
void _showDropdownMenu(BuildContext context) {
final RenderBox button = context.findRenderObject() as RenderBox;
final RenderBox overlay =
Overlay.of(context)!.context.findRenderObject() as RenderBox;
final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints(
button.localToGlobal(Offset.zero, ancestor: overlay),
button.localToGlobal(button.size.bottomLeft(Offset.zero),
@Devlonoah
Devlonoah / custom_navbar.dart
Created July 27, 2022 21:58
reusable custom navbar with indicator using flutter_bloc as state managent
import 'package:fdis/bloc/tab_bloc/tab_bloc.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class CustomTabBar extends StatelessWidget {
const CustomTabBar({
Key? key,
}) : super(key: key);
@override
@Devlonoah
Devlonoah / main.dart
Created November 18, 2021 22:33
Using bloc with pageview
import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'bloc/intro_bloc.dart';
void main() {
runApp(const MyApp());
}
@Devlonoah
Devlonoah / main.dart
Created November 18, 2021 13:07
Web Demo
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
const String bookCoverImageUrl =
"https://images.unsplash.com/photo-1637083197568-c930e15c0d33?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw1fHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60";
void main() {
runApp(MyApp());
}
@Devlonoah
Devlonoah / stream_of_data.dart
Created October 1, 2021 18:17
Listening to stream of data by using streamsubscription
import "dart:async";
void main() {
StreamSubscription<int> data;
data = createStream([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]).listen((x) {
print(x);
});
data.onDone(() {