मुख्य सामग्री पर जाएँ
CrossFly 100% ओपन सोर्सGitHub पर फ़ॉलो करें
CrossFlyCrossFly
शुरू करें

यह पृष्ठ पुर्तगाली से मशीन-अनुवादित है और इसमें त्रुटियाँ हो सकती हैं। पुर्तगाली संस्करण प्रामाणिक है।

Flutter से आना

Flutter CrossFly का दार्शनिक रूप से सबसे निकटतम साथी है — दोनों GPU के माध्यम से रेंडर करते हैं, बिना नेटिव विजेट्स के, इसलिए दिखावट सभी प्लेटफ़ॉर्म पर एक समान है। अंतर मॉडल में है: Flutter स्टेट से पुनर्निर्माण करता है; CrossFly में आप ऑब्जेक्ट्स को म्यूट करते हैं। पहले दर्शन पढ़ें।

अनुवाद तालिका

Flutter CrossFly
Widget Component
StatelessWidget / StatefulWidget Component / Window का सबक्लास
build(context) onShow() (माउंट करना) / onPaint() (ड्रॉ करना)
setState(() => ...) फ़ील्ड म्यूट करें + repaint() (+ setValidLayout(false) यदि आकार बदला)
Scaffold Window (+ टैब के लिए TabBar)
Navigator.push / pop window.show() / hide()
Column / Row VerticalLayout / HorizontalLayout
Expanded / Flexible add(LAY_FILL, c) (-1f)
Padding स्टाइल में ingap (ComponentStyle)
SizedBox / Spacer लेआउट में Gap / अंश
ListView.builder VirtualListView
Text Label
ElevatedButton / TextButton Button
TextField TextField
showDialog / AlertDialog Alert
SnackBar / Tooltip Hint
Theme / ThemeData Theme / ColorScheme / Skin
Future / async / await Thread + Component.onUI(...)
Color(0xFF2196F3) int 0xFF2196F3 (UIConstants / ColorUtils)
shared_preferences कोई समकक्ष नहीं → SQLite (गाइड)

एक्शन के साथ बटन

// Flutter
ElevatedButton(onPressed: salvar, child: Text("Salvar"))
// CrossFly
new Button("Salvar").onAction(c -> salvar());

सूची वाली स्क्रीन

// Flutter
ListView.builder(itemCount: itens.length,
   itemBuilder: (ctx, i) => ListTile(title: Text(itens[i].nome)));
// CrossFly — वर्चुअलाइज़्ड, onShow() में माउंट किया गया
VirtualListView lista = new VirtualListView(Relative.ofFont(3f), new DataAdapter() {
   public int getCount() { return itens.size(); }
   public Component createView() { return new Label(""); }
   public void bindView(Component v, int i) { ((Label) v).setText(itens.get(i).nome); }
});
add(LAY_FILL, lista);

पुष्टिकरण डायलॉग

// Flutter
showDialog(context: ctx, builder: (_) => AlertDialog(
   title: Text("Excluir"), content: Text("Confirma?"),
   actions: [ TextButton(onPressed: excluir, child: Text("Excluir")) ]));
// CrossFly — कंस्ट्रक्टर में टेक्स्ट; क्रिया इंडेक्स द्वारा
Alert a = new Alert("Excluir", "Confirma?", "Cancelar", "Excluir");
a.buttonAction(1, c -> excluir());
a.show();

बदलाव के दौरान सर्वोत्तम प्रथाएँ

  • जहाँ आप setState करते, वहाँ म्यूटेशन + repaint() करें — विजेट का रेफ़रेंस रखें।
  • जहाँ FutureBuilder/async था, वहाँ Thread + Component.onUI का उपयोग करें (देखें background)।
  • Expanded बन जाता है LAY_FILL; Padding बन जाता है स्टाइल में ingap।

यह भी देखें

क्या यह पृष्ठ उपयोगी था?